diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-02-01 18:02:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-01 18:02:59 -0500 |
commit | 363073568e492ba51d5fefc899ff0ceed074f707 (patch) | |
tree | 7320f218b8d86f872a7b4ba67e714ac866ecd316 /python/servo/command_base.py | |
parent | 4a6b9119087bfbf1de8c29182a0c7bd14d5d82d0 (diff) | |
parent | f374dc3b7da5205bb1bf8d8d63b5e73f610309f0 (diff) | |
download | servo-363073568e492ba51d5fefc899ff0ceed074f707.tar.gz servo-363073568e492ba51d5fefc899ff0ceed074f707.zip |
Auto merge of #21968 - UK992:mach-package, r=jdm
Windows: Add missing dependencies
Rebased https://github.com/servo/servo/pull/16445 and updated with Gstreamer DLLs.
About msi installer, there is also included gstreamer installer, should be removed and replaced by needed gstreamer DLLs or keep it at is it?
Fixes #16422.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21968)
<!-- Reviewable:end -->
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r-- | python/servo/command_base.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 393808213a6..a8bba6c6d59 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -22,6 +22,7 @@ import subprocess from subprocess import PIPE import sys import tarfile +import zipfile from xml.etree.ElementTree import XML from servo.util import download_file import urllib2 @@ -86,10 +87,14 @@ def archive_deterministically(dir_to_archive, dest_archive, prepend_path=None): dest_archive = os.path.abspath(dest_archive) with cd(dir_to_archive): current_dir = "." - file_list = [current_dir] + file_list = [] for root, dirs, files in os.walk(current_dir): - for name in itertools.chain(dirs, files): - file_list.append(os.path.join(root, name)) + if dest_archive.endswith(".zip"): + for f in files: + file_list.append(os.path.join(root, f)) + else: + for name in itertools.chain(dirs, files): + file_list.append(os.path.join(root, name)) # Sort file entries with the fixed locale with setlocale('C'): @@ -100,13 +105,21 @@ def archive_deterministically(dir_to_archive, dest_archive, prepend_path=None): # TODO do this in a temporary folder after #11983 is fixed temp_file = '{}.temp~'.format(dest_archive) with os.fdopen(os.open(temp_file, os.O_WRONLY | os.O_CREAT, 0644), 'w') as out_file: - with gzip.GzipFile('wb', fileobj=out_file, mtime=0) as gzip_file: - with tarfile.open(fileobj=gzip_file, mode='w:') as tar_file: + if dest_archive.endswith('.zip'): + with zipfile.ZipFile(temp_file, 'w', zipfile.ZIP_DEFLATED) as zip_file: for entry in file_list: arcname = entry if prepend_path is not None: arcname = os.path.normpath(os.path.join(prepend_path, arcname)) - tar_file.add(entry, filter=reset, recursive=False, arcname=arcname) + zip_file.write(entry, arcname=arcname) + else: + with gzip.GzipFile('wb', fileobj=out_file, mtime=0) as gzip_file: + with tarfile.open(fileobj=gzip_file, mode='w:') as tar_file: + for entry in file_list: + arcname = entry + if prepend_path is not None: + arcname = os.path.normpath(os.path.join(prepend_path, arcname)) + tar_file.add(entry, filter=reset, recursive=False, arcname=arcname) os.rename(temp_file, dest_archive) |