138138import sys
139139import tempfile
140140import urllib
141- import urllib2
141+ from urllib . request import urlopen , FancyURLopener
142142import zipfile
143143
144144##
@@ -258,7 +258,7 @@ def exec_cmd(cmd, path):
258258 stderr = subprocess .PIPE ,
259259 shell = (sys .platform == 'win32' ))
260260 out , err = process .communicate ()
261- except IOError , ( errno , strerror ) :
261+ except IOError :
262262 raise
263263 except :
264264 raise
@@ -300,7 +300,7 @@ def download_and_extract(src, target):
300300
301301 if src [:4 ] == 'http' :
302302 # Attempt to download a URL.
303- opener = urllib . FancyURLopener ({})
303+ opener = FancyURLopener ({})
304304 response = opener .open (src )
305305
306306 temporary = True
@@ -462,7 +462,7 @@ def onerror(func, path, exc_info):
462462def read_json_url (url ):
463463 """ Read a JSON URL. """
464464 msg ('Downloading %s' % url )
465- response = urllib2 . urlopen (url )
465+ response = urlopen (url )
466466 return json .loads (response .read ())
467467
468468
@@ -1051,7 +1051,7 @@ def check_pattern_matches(output_file=None):
10511051(options , args ) = parser .parse_args ()
10521052
10531053if options .downloaddir is None :
1054- print "The --download-dir option is required."
1054+ print ( "The --download-dir option is required." )
10551055 parser .print_help (sys .stderr )
10561056 sys .exit ()
10571057
@@ -1074,7 +1074,7 @@ def check_pattern_matches(output_file=None):
10741074 if (options .nocefupdate and options .forceupdate ):
10751075 pass
10761076 else :
1077- print "Invalid combination of options."
1077+ print ( "Invalid combination of options." )
10781078 parser .print_help (sys .stderr )
10791079 sys .exit ()
10801080 # --
@@ -1083,25 +1083,25 @@ def check_pattern_matches(output_file=None):
10831083 (options .minimaldistrib or options .minimaldistribonly or \
10841084 options .clientdistrib or options .clientdistribonly )) or \
10851085 (options .minimaldistribonly + options .clientdistribonly + options .sandboxdistribonly > 1 ):
1086- print 'Invalid combination of options.'
1086+ print ( 'Invalid combination of options.' )
10871087 parser .print_help (sys .stderr )
10881088 sys .exit ()
10891089
10901090if options .x64build and options .armbuild :
1091- print 'Invalid combination of options.'
1091+ print ( 'Invalid combination of options.' )
10921092 parser .print_help (sys .stderr )
10931093 sys .exit ()
10941094
10951095if (options .buildtests or options .runtests ) and len (options .testtarget ) == 0 :
1096- print "A test target must be specified via --test-target."
1096+ print ( "A test target must be specified via --test-target." )
10971097 parser .print_help (sys .stderr )
10981098 sys .exit ()
10991099
11001100# Operating system.
11011101if options .dryrun and options .dryrunplatform is not None :
11021102 platform = options .dryrunplatform
11031103 if not platform in ['windows' , 'macosx' , 'linux' ]:
1104- print 'Invalid dry-run-platform value: %s' % (platform )
1104+ print ( 'Invalid dry-run-platform value: %s' % (platform ) )
11051105 sys .exit ()
11061106elif sys .platform == 'win32' :
11071107 platform = 'windows'
@@ -1110,7 +1110,7 @@ def check_pattern_matches(output_file=None):
11101110elif sys .platform .startswith ('linux' ):
11111111 platform = 'linux'
11121112else :
1113- print 'Unknown operating system platform'
1113+ print ( 'Unknown operating system platform' )
11141114 sys .exit ()
11151115
11161116# Script extension.
@@ -1125,25 +1125,25 @@ def check_pattern_matches(output_file=None):
11251125 else :
11261126 client_app = 'cefclient'
11271127 if options .buildtarget .find (client_app ) == - 1 :
1128- print 'A client distribution cannot be generated if --build-target ' + \
1129- 'excludes %s.' % client_app
1128+ print ( 'A client distribution cannot be generated if --build-target ' + \
1129+ 'excludes %s.' % client_app )
11301130 parser .print_help (sys .stderr )
11311131 sys .exit ()
11321132
11331133if platform != 'windows' and (options .sandboxdistrib or
11341134 options .sandboxdistribonly ):
1135- print 'The sandbox distribution is only supported on Windows.'
1135+ print ( 'The sandbox distribution is only supported on Windows.' )
11361136 sys .exit ()
11371137
11381138# CEF branch.
11391139if options .branch != 'trunk' and not options .branch .isdigit ():
1140- print 'Invalid branch value: %s' % (options .branch )
1140+ print ( 'Invalid branch value: %s' % (options .branch ) )
11411141 sys .exit ()
11421142
11431143cef_branch = options .branch
11441144
11451145if cef_branch != 'trunk' and int (cef_branch ) <= 1453 :
1146- print 'The requested branch is too old to build using this tool.'
1146+ print ( 'The requested branch is too old to build using this tool.' )
11471147 sys .exit ()
11481148
11491149# True if the requested branch is 2272 or newer.
@@ -1166,28 +1166,28 @@ def check_pattern_matches(output_file=None):
11661166use_gn = bool (int (os .environ .get ('CEF_USE_GN' , '0' )))
11671167if use_gn :
11681168 if branch_is_2743_or_older :
1169- print 'GN is not supported with branch 2743 and older (set CEF_USE_GN=0).'
1169+ print ( 'GN is not supported with branch 2743 and older (set CEF_USE_GN=0).' )
11701170 sys .exit ()
11711171
11721172 if options .armbuild :
11731173 if platform != 'linux' :
1174- print 'The ARM build option is only supported on Linux.'
1174+ print ( 'The ARM build option is only supported on Linux.' )
11751175 sys .exit ()
11761176
11771177 if not branch_is_newer_than_2785 :
1178- print 'The ARM build option is not supported with branch 2785 and older.'
1178+ print ( 'The ARM build option is not supported with branch 2785 and older.' )
11791179 sys .exit ()
11801180else :
11811181 if options .armbuild :
1182- print 'The ARM build option is not supported by GYP.'
1182+ print ( 'The ARM build option is not supported by GYP.' )
11831183 sys .exit ()
11841184
11851185 if options .x64build and platform != 'windows' and platform != 'macosx' :
1186- print 'The x64 build option is only used on Windows and Mac OS X.'
1186+ print ( 'The x64 build option is only used on Windows and Mac OS X.' )
11871187 sys .exit ()
11881188
11891189 if platform == 'windows' and not 'GYP_MSVS_VERSION' in os .environ .keys ():
1190- print 'You must set the GYP_MSVS_VERSION environment variable on Windows.'
1190+ print ( 'You must set the GYP_MSVS_VERSION environment variable on Windows.' )
11911191 sys .exit ()
11921192
11931193 # True if GYP_DEFINES=target_arch=x64 must be set.
@@ -1203,8 +1203,8 @@ def check_pattern_matches(output_file=None):
12031203 deps_file = '.DEPS.git'
12041204
12051205if platform == 'macosx' and not options .x64build and branch_is_2272_or_newer :
1206- print '32-bit Mac OS X builds are no longer supported with 2272 branch and ' + \
1207- 'newer. Add --x64-build flag to generate a 64-bit build.'
1206+ print ( '32-bit Mac OS X builds are no longer supported with 2272 branch and ' + \
1207+ 'newer. Add --x64-build flag to generate a 64-bit build.' )
12081208 sys .exit ()
12091209
12101210# Options that force the sources to change.
@@ -1214,7 +1214,7 @@ def check_pattern_matches(output_file=None):
12141214discard_local_changes = force_change or options .forcecefupdate
12151215
12161216if options .resave and (options .forcepatchupdate or discard_local_changes ):
1217- print '--resave cannot be combined with options that modify or discard patches.'
1217+ print ( '--resave cannot be combined with options that modify or discard patches.' )
12181218 parser .print_help (sys .stderr )
12191219 sys .exit ()
12201220
0 commit comments