aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2019-10-18 01:22:56 +0200
committerTim Jenssen <tim.jenssen@qt.io>2019-10-17 23:24:31 +0000
commit1c06c077f15f1a6dfd163e5f1ed6931411481743 (patch)
treec0584d9a7b060f4162c05a89e815c46d016436aa
parent78104edf0ced75abffdc6e293fd43bfa82a28fee (diff)
download method can be used with file://
With python 2 the scheme of absolute windows path is not empty -> urlparse.urlparse("C:\\").scheme c So this everywhere use line -> scheme = "" if urlparse.urlparse(pkg_base_path).scheme != "" else "file://" is not doing the expected thing then. Change-Id: Ibecf9a11717fa303411c4c4848d3b3599654d4dd Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--packaging-tools/bld_utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/packaging-tools/bld_utils.py b/packaging-tools/bld_utils.py
index 6e513e26e..48d84563a 100644
--- a/packaging-tools/bld_utils.py
+++ b/packaging-tools/bld_utils.py
@@ -131,6 +131,10 @@ def download(url, target, read_block_size = 1048576):
if os.path.lexists(target):
raise Exception("Can not download '{0}' to '{1}' as target. The file already exists.".format(url, target))
# now a download can be a local path
+ if url.startswith("file://"):
+ # because scheme of a absolute windows path is the drive letter in python 2,
+ # we need to use file:// as a work around in urls
+ url = url[len("file://"):]
if os.path.lexists(url) and os.path.isfile(url):
print("copying file from '{0}' to {1}".format(url, target))
try: