aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-02-06 13:00:41 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-02-06 12:17:36 +0000
commitbc254363c36bee262f7e0477f5e3d0b5987fb3ba (patch)
treefd70c27f4f262dff9ead69e14fdc1df666e18198 /build_scripts
parent8e3c7aab0eae6b316cfffd2f3c3457dadc97bdeb (diff)
Build scripts: Make location of 7z a bit smarter on Windows
Check for the default install location in case it was not added to the path. Change-Id: I6f21353147552ed6f556f79878e6ba89dc40cb43 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'build_scripts')
-rw-r--r--build_scripts/utils.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/build_scripts/utils.py b/build_scripts/utils.py
index ffe404860..019090dab 100644
--- a/build_scripts/utils.py
+++ b/build_scripts/utils.py
@@ -733,6 +733,8 @@ def detect_clang():
clang_dir = clang_dir.replace('_ARCH_', arch)
return (clang_dir, source)
+_7z_binary = None
+
def download_and_extract_7z(fileurl, target):
""" Downloads 7z file from fileurl and extract to target """
print("Downloading fileUrl {} ".format(fileurl))
@@ -744,9 +746,17 @@ def download_and_extract_7z(fileurl, target):
raise RuntimeError(' Error downloading {}'.format(fileurl))
try:
+ global _7z_binary
outputDir = "-o" + target
- print("calling 7z x {} {}".format(localfile, outputDir))
- subprocess.call(["7z", "x", "-y", localfile, outputDir])
+ if not _7z_binary:
+ if sys.platform == 'win32':
+ candidate = 'c:\\Program Files\\7-Zip\\7z.exe'
+ if os.path.exists(candidate):
+ _7z_binary = candidate
+ if not _7z_binary:
+ _7z_binary = '7z'
+ print("calling {} x {} {}".format(_7z_binary, localfile, outputDir))
+ subprocess.call([_7z_binary, "x", "-y", localfile, outputDir])
except:
raise RuntimeError(' Error extracting {}'.format(localfile))