@@ -724,20 +724,21 @@ def icu_download(path):
724
724
]
725
725
def fmtMb (amt ):
726
726
return "{:.1f}" .format (amt / 1024000. )
727
+ spin = "\\ |/-"
727
728
def reporthook (count , size , total ):
728
- sys .stdout .write ('%sMB total, %sMB downloaded \r ' %
729
- (fmtMb (total ),fmtMb (count * size )))
729
+ sys .stdout .write ('%c % sMB total, %sMB downloaded \r ' %
730
+ (spin [ count % 4 ], fmtMb (total ), fmtMb (count * size )))
730
731
for icu in icus :
731
732
url = icu ['url' ]
732
733
md5 = icu ['md5' ]
733
734
local = url .split ('/' )[- 1 ]
734
735
targetfile = os .path .join (root_dir , 'deps' , local )
735
736
if not os .path .isfile (targetfile ):
736
737
try :
737
- sys .stdout .write ('Downloading ICU from %s\n Connecting...\r ' % url )
738
+ sys .stdout .write ('Downloading ICU: \n %s\n Connecting...\r ' % url )
738
739
sys .stdout .flush ()
739
740
msg = urllib .urlretrieve (url , targetfile , reporthook = reporthook )
740
- sys . stdout . write ( ' \n ' ) # newline
741
+ print '' # clear the line
741
742
print 'Downloaded %s' % local
742
743
except :
743
744
print 'Error occurred while downloading %s' % url
@@ -748,9 +749,8 @@ def icu_download(path):
748
749
print 'Not re-downloading %s (delete it to retry)' % targetfile
749
750
if os .path .isfile (targetfile ) and md5 is not None :
750
751
print 'Should have md5sum %s' % md5
751
- print 'TODO: SKIPPING md5sum check'
752
-
753
-
752
+ print 'TODO: SKIPPING md5sum check, assuming OK!'
753
+ return targetfile
754
754
print 'Please see the README.md - could not automatically download ICU.'
755
755
return None
756
756
@@ -782,6 +782,8 @@ def configure_intl(o):
782
782
o ['variables' ]['icu_gyp_path' ] = options .with_icu_path
783
783
return
784
784
# --with-intl=<with_intl>
785
+ if with_intl is None :
786
+ with_intl = 'none' # this is the default 'intl' mode.
785
787
if with_intl == 'none' or with_intl is None :
786
788
o ['variables' ]['v8_enable_i18n_support' ] = 0
787
789
return # no Intl
@@ -816,14 +818,19 @@ def configure_intl(o):
816
818
byteorder = sys .byteorder
817
819
o ['variables' ]['icu_gyp_path' ] = 'tools/icu/icu-generic.gyp'
818
820
# ICU source dir relative to root
819
- icu_full_path = os .path .join (root_dir , 'deps/icu' )
821
+ icu_parent_path = os .path .join (root_dir , 'deps' )
822
+ icu_full_path = os .path .join (icu_parent_path , 'icu' )
820
823
o ['variables' ]['icu_path' ] = icu_full_path
821
824
if not os .path .isdir (icu_full_path ):
825
+ print 'ECMA-402 (Intl) needs an ICU in %s' % (icu_full_path )
826
+ # can we download (or find) a zipfile?
822
827
localzip = icu_download (icu_full_path )
823
828
if localzip :
824
- print 'Got local zip: %s' % localzip
829
+ with zipfile .ZipFile (localzip , 'r' ) as icuzip :
830
+ print 'Extracting ICU source zip: %s' % localzip
831
+ icuzip .extractall (icu_parent_path )
825
832
if not os .path .isdir (icu_full_path ):
826
- print 'Error: ICU path is not a directory and couldn \' t download: %s ' % (icu_full_path )
833
+ print 'Cannot continue without ICU in %s. ' % (icu_full_path )
827
834
sys .exit (1 )
828
835
# Now, what version of ICU is it? We just need the "major", such as 54.
829
836
# uvernum.h contains it as a #define.
0 commit comments