mirror of
https://github.com/servo/servo.git
synced 2025-06-29 19:43:39 +01:00
Fix BadZipfile error while install msvc dependencies
This commit is contained in:
parent
7256d123ff
commit
9c1683bcef
1 changed files with 17 additions and 7 deletions
|
@ -12,6 +12,7 @@ import platform
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
|
from zipfile import BadZipfile
|
||||||
|
|
||||||
import servo.packages as packages
|
import servo.packages as packages
|
||||||
from servo.util import extract, download_file, host_triple
|
from servo.util import extract, download_file, host_triple
|
||||||
|
@ -300,6 +301,21 @@ def windows_msvc(context, force=False):
|
||||||
return True
|
return True
|
||||||
return False
|
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 = {}
|
to_install = {}
|
||||||
for package in packages.WINDOWS_MSVC:
|
for package in packages.WINDOWS_MSVC:
|
||||||
# Don't install CMake if it already exists in PATH
|
# Don't install CMake if it already exists in PATH
|
||||||
|
@ -321,13 +337,7 @@ def windows_msvc(context, force=False):
|
||||||
os.makedirs(parent_dir)
|
os.makedirs(parent_dir)
|
||||||
|
|
||||||
zip_path = package_dir(package) + ".zip"
|
zip_path = package_dir(package) + ".zip"
|
||||||
if not os.path.isfile(zip_path):
|
prepare_file(zip_path, full_spec)
|
||||||
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")
|
|
||||||
|
|
||||||
extracted_path = os.path.join(deps_dir, full_spec)
|
extracted_path = os.path.join(deps_dir, full_spec)
|
||||||
os.rename(extracted_path, package_dir(package))
|
os.rename(extracted_path, package_dir(package))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue