aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/bootstrap.py
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-01-21 13:49:48 -0500
committerGitHub <noreply@github.com>2019-01-21 13:49:48 -0500
commit6bce9a1d1b075cf40c901aab821fa192361be64b (patch)
tree396e1a2d01e859bb7282a2c8e55b8cc9da1f5a2d /python/servo/bootstrap.py
parent00148da264429cb4affc891b3828fa868e6baec0 (diff)
parent9c1683bcef9cb09e76c542bc0cc9340eed8cd47a (diff)
downloadservo-6bce9a1d1b075cf40c901aab821fa192361be64b.tar.gz
servo-6bce9a1d1b075cf40c901aab821fa192361be64b.zip
Auto merge of #22734 - learning:patch-msvc-install, r=jdm
Fix BadZipfile error while install msvc dependencies <!-- Please describe your changes on the following line: --> Fix BadZipfile error while install msvc dependencies --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #22727 <!-- Either: --> - [X] These changes do not require tests because it's a patch to `mach` <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/22734) <!-- Reviewable:end -->
Diffstat (limited to 'python/servo/bootstrap.py')
-rw-r--r--python/servo/bootstrap.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/python/servo/bootstrap.py b/python/servo/bootstrap.py
index 4f9744a7c17..1c49ab67185 100644
--- a/python/servo/bootstrap.py
+++ b/python/servo/bootstrap.py
@@ -12,6 +12,7 @@ import platform
import shutil
import subprocess
from subprocess import PIPE
+from zipfile import BadZipfile
import servo.packages as packages
from servo.util import extract, download_file, host_triple
@@ -300,6 +301,21 @@ def windows_msvc(context, force=False):
return True
return False
+ def prepare_file(zip_path, full_spec):
+ if not os.path.isfile(zip_path):
+ zip_url = "{}{}.zip".format(deps_url, full_spec)
+ download_file(full_spec, zip_url, zip_path)
+
+ print("Extracting {}...".format(full_spec), end='')
+ try:
+ extract(zip_path, deps_dir)
+ except BadZipfile:
+ print("\nError: %s.zip is not a valid zip file, redownload..." % full_spec)
+ os.remove(zip_path)
+ prepare_file(zip_path, full_spec)
+ else:
+ print("done")
+
to_install = {}
for package in packages.WINDOWS_MSVC:
# Don't install CMake if it already exists in PATH
@@ -321,13 +337,7 @@ def windows_msvc(context, force=False):
os.makedirs(parent_dir)
zip_path = package_dir(package) + ".zip"
- if not os.path.isfile(zip_path):
- zip_url = "{}{}.zip".format(deps_url, full_spec)
- download_file(full_spec, zip_url, zip_path)
-
- print("Extracting {}...".format(full_spec), end='')
- extract(zip_path, deps_dir)
- print("done")
+ prepare_file(zip_path, full_spec)
extracted_path = os.path.join(deps_dir, full_spec)
os.rename(extracted_path, package_dir(package))