55
55
binaries_location = os .path .join (os .getcwd (), binaries_location )
56
56
57
57
if not os .path .isdir (binaries_location ):
58
- print 'Invalid path: ' + binaries_location
58
+ print ( 'Invalid path: ' + binaries_location )
59
59
exit (- 1 )
60
60
binaries_location = os .path .normpath (binaries_location )
61
61
dist_dir = os .path .join (binaries_location , 'dist' )
62
62
63
- print 'Working on ' + binaries_location
63
+ print ( 'Working on ' + binaries_location )
64
64
65
65
nwfolder = os .path .join (dist_dir , '..' , 'nwdist' )
66
66
try :
80
80
elif sys .platform == 'darwin' :
81
81
platform_name = 'osx'
82
82
else :
83
- print 'Unsupported platform: ' + sys .platform
83
+ print ( 'Unsupported platform: ' + sys .platform )
84
84
exit (- 1 )
85
85
86
86
_arch = platform .architecture ()[0 ]
89
89
elif _arch == '32bit' :
90
90
arch = 'ia32'
91
91
else :
92
- print 'Unsupported arch: ' + _arch
92
+ print ( 'Unsupported arch: ' + _arch )
93
93
exit (- 1 )
94
94
95
95
if platform_name == 'win' :
@@ -222,7 +222,7 @@ def generate_target_nw(platform_name, arch, version):
222
222
target ['input' ].append ('minidump_stackwalk' )
223
223
target ['input' ].append ('v8_context_snapshot.x86_64.bin' )
224
224
else :
225
- print 'Unsupported platform: ' + platform_name
225
+ print ( 'Unsupported platform: ' + platform_name )
226
226
exit (- 1 )
227
227
return target
228
228
@@ -282,7 +282,7 @@ def generate_target_symbols(platform_name, arch, version):
282
282
]
283
283
target ['folder' ] = True
284
284
else :
285
- print 'Unsupported platform: ' + platform_name
285
+ print ( 'Unsupported platform: ' + platform_name )
286
286
exit (- 1 )
287
287
return target
288
288
@@ -296,10 +296,10 @@ def generate_target_headers(platform_name, arch, version):
296
296
# here , call make-nw-headers.py to generate nw headers
297
297
make_nw_header = os .path .join (os .path .dirname (__file__ ), \
298
298
'make-nw-headers.py' )
299
- print make_nw_header
299
+ print ( make_nw_header )
300
300
res = call (['python' , make_nw_header , '-p' , binaries_location , '-n' , platform_name ])
301
301
if res == 0 :
302
- print 'nw-headers generated'
302
+ print ( 'nw-headers generated' )
303
303
nw_headers_name = 'nw-headers-v' + version + '.tar.gz'
304
304
nw_headers_path = os .path .join (os .path .dirname (__file__ ), \
305
305
os .pardir , 'tmp' , nw_headers_name )
@@ -315,7 +315,7 @@ def generate_target_headers(platform_name, arch, version):
315
315
target ['input' ].append ('SHASUMS256.txt' )
316
316
else :
317
317
#TODO, handle err
318
- print 'nw-headers generate failed'
318
+ print ( 'nw-headers generate failed' )
319
319
return target
320
320
321
321
def generate_target_empty (platform_name , arch , version ):
@@ -372,7 +372,7 @@ def _ArchiveDirectory(parentDirectory):
372
372
zipInfo .create_system = 3
373
373
# long type of hex val of '0xA1ED0000L',
374
374
# say, symlink attr magic...
375
- zipInfo .external_attr = 2716663808L
375
+ zipInfo .external_attr = 2716663808
376
376
zipOut .writestr (zipInfo , os .readlink (fullPath ))
377
377
else :
378
378
zipOut .write (fullPath , archiveRoot , zipfile .ZIP_DEFLATED )
@@ -394,21 +394,21 @@ def compress(from_dir, to_dir, fname, compress):
394
394
z .close ()
395
395
elif compress == 'tar.gz' : # only for folders
396
396
if not os .path .isdir (_from ):
397
- print 'Will not create tar.gz for a single file: ' + _from
397
+ print ( 'Will not create tar.gz for a single file: ' + _from )
398
398
exit (- 1 )
399
399
with tarfile .open (_to + '.tar.gz' , 'w:gz' ) as tar :
400
400
tar .add (_from , arcname = os .path .basename (_from ))
401
401
elif compress == 'gz' : # only for single file
402
402
if os .path .isdir (_from ):
403
- print 'Will not create gz for a folder: ' + _from
403
+ print ( 'Will not create gz for a folder: ' + _from )
404
404
exit (- 1 )
405
405
f_in = open (_from , 'rb' )
406
406
f_out = gzip .open (_to + '.gz' , 'wb' )
407
407
f_out .writelines (f_in )
408
408
f_out .close ()
409
409
f_in .close ()
410
410
else :
411
- print 'Unsupported compression format: ' + compress
411
+ print ( 'Unsupported compression format: ' + compress )
412
412
exit (- 1 )
413
413
414
414
@@ -418,13 +418,13 @@ def make_packages(targets):
418
418
for f in t ['input' ]:
419
419
src = os .path .join (binaries_location , f )
420
420
if not os .path .exists (src ):
421
- print 'File does not exist: ' , src
421
+ print ( 'File does not exist: ' , src )
422
422
exit (- 1 )
423
423
424
424
# clear the output folder
425
425
if os .path .exists (dist_dir ):
426
426
if not os .path .isdir (dist_dir ):
427
- print 'Invalid path: ' + dist_dir
427
+ print ( 'Invalid path: ' + dist_dir )
428
428
exit (- 1 )
429
429
else :
430
430
shutil .rmtree (dist_dir )
@@ -441,10 +441,10 @@ def make_packages(targets):
441
441
dest = os .path .join (dist_dir , t ['output' ])
442
442
else :
443
443
dest = os .path .join (dist_dir , f )
444
- print "Copying " + f
444
+ print ( "Copying " + f )
445
445
shutil .copy (src , dest )
446
- elif (t . has_key ( 'folder' ) and t ['folder' ] == True ) or len (t ['input' ]) > 1 :
447
- print 'Making "' + t ['output' ] + '.' + t ['compress' ] + '"'
446
+ elif ('folder' in t and t ['folder' ] == True ) or len (t ['input' ]) > 1 :
447
+ print ( 'Making "' + t ['output' ] + '.' + t ['compress' ] + '"' )
448
448
# copy files into a folder then pack
449
449
folder = os .path .join (dist_dir , t ['output' ])
450
450
os .mkdir (folder )
@@ -461,13 +461,13 @@ def make_packages(targets):
461
461
shutil .copy (src , dest )
462
462
compress (dist_dir , dist_dir , t ['output' ], t ['compress' ])
463
463
# remove temp folders
464
- if (t . has_key ( 'keep4test' ) ) :
464
+ if ('keep4test' in t ) :
465
465
shutil .copytree (folder , nwfolder , symlinks = True )
466
466
467
467
shutil .rmtree (folder )
468
468
else :
469
469
# single file
470
- print 'Making "' + t ['output' ] + '.' + t ['compress' ] + '"'
470
+ print ( 'Making "' + t ['output' ] + '.' + t ['compress' ] + '"' )
471
471
compress (binaries_location , dist_dir , t ['input' ][0 ], t ['compress' ])
472
472
473
473
# must be aligned with steps
@@ -487,7 +487,7 @@ def make_packages(targets):
487
487
continue
488
488
targets .append (generators [s ](platform_name , arch , nw_ver ))
489
489
490
- print 'Creating packages...'
490
+ print ( 'Creating packages...' )
491
491
make_packages (targets )
492
492
493
493
# vim: et:ts=4:sw=4
0 commit comments