avoid duplicate files when building a zip

This commit is contained in:
Jeremy Apthorp 2018-10-02 21:49:10 -07:00 коммит произвёл Aleksei Kuzmin
Родитель d4c8375702
Коммит 81bd7fab55
1 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -56,14 +56,13 @@ def execute(argv):
def main(argv):
dist_zip, runtime_deps, target_cpu, target_os = argv
dist_files = []
dist_files = set()
with open(runtime_deps) as f:
for dep in f.readlines():
dep = dep.strip()
if dep not in dist_files:
dist_files += [dep]
dist_files.add(dep)
if sys.platform == 'darwin':
mac_zip_results = execute(['zip', '-r', '-y', dist_zip] + dist_files)
execute(['zip', '-r', '-y', dist_zip] + list(dist_files))
else:
with zipfile.ZipFile(dist_zip, 'w', zipfile.ZIP_DEFLATED) as z:
for dep in dist_files: