File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 33# Uses the Python zip implementation to create deterministic XPI's
44# Author: Yan Zhu, yan@mit.edu
55
6+ # ZipFile: infolist, write, writestr,
7+
68import os
79import zipfile2_6 as zipfile
810import sys
@@ -26,13 +28,18 @@ def createTmpZipInfo():
2628 Create a non-deterministic zip in order to use the file info
2729 generated to create a deterministic zip
2830 """
29- xpiFileTmp = zipfile .ZipFile (tmpfile , mode = 'w' )
31+ xpiFileTmp = zipfile .ZipFile (tmpfile , mode = 'w' , compression = compress )
32+ filesToAdd = [] # need to create arr for deterministic sorting
3033 for root ,subfolders ,files in os .walk ('.' ):
3134 for fi in files :
3235 filename = os .path .join (root ,fi )
3336 if filename not in map (lambda x : './' + x , exclusions ):
34- xpiFileTmp .write (filename , compress_type = compress )
37+ filesToAdd .append (filename )
38+ filesToAdd .sort ()
39+ for filename in filesToAdd :
40+ xpiFileTmp .write (filename , compress_type = compress )
3541 xpiFileTmp .close ()
42+ xpiFileTmp .infolist ().sort (key = lambda x : x .filename )
3643 return xpiFileTmp .infolist ()
3744
3845def constructZipDet ():
You can’t perform that action at this time.
0 commit comments