File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 1111with open (exclusionsFile ) as f :
1212 for line in f :
1313 exclusions .extend (glob .glob (line .strip ()))
14- print (exclusions )
1514
1615xpiFile = zipfile .ZipFile (xpiName , mode = 'w' )
1716
17+ def constructZipInfo (filename ):
18+ """Create deterministic ZIP metadata for a given file"""
19+ info = zipfile .ZipInfo (filename , time .gmtime (1378343307 ))
20+ info .compress_type = 0
21+ info .comment = ''
22+ info .extra = ''
23+ info .create_system = 3
24+ info .create_version = 20
25+ info .extract_version = 20
26+ if os .path .isfile (filename ):
27+ info .external_attr = 0664 << 16L
28+ elif os .path .isdir (filename ):
29+ info .external_attr = 04775 << 16L
30+ # info.external_attr = 2176057344L
31+ info .volume = 0
32+ return info
33+
1834for root ,subfolders ,files in os .walk ('.' ):
1935 for fi in files :
2036 filename = os .path .join (root ,fi )
2137 if filename not in map (lambda x : './' + x , exclusions ):
22- print (filename )
23- info = zipfile . ZipInfo (filename , time . gmtime ( 1378343307 ) )
24- xpiFile .writestr (info , '' )
38+ print ("Adding to zip: " + filename )
39+ info = constructZipInfo (filename )
40+ xpiFile .writestr (info , open ( filename ). read () )
2541
2642xpiFile .close ()
You can’t perform that action at this time.
0 commit comments