diff options
author | Tim Jenssen <tim.jenssen@qt.io> | 2019-10-18 01:22:56 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2019-10-17 23:24:31 +0000 |
commit | 1c06c077f15f1a6dfd163e5f1ed6931411481743 (patch) | |
tree | c0584d9a7b060f4162c05a89e815c46d016436aa | |
parent | 78104edf0ced75abffdc6e293fd43bfa82a28fee (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.py | 4 |
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: |