summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2021-07-03 00:20:09 -0500
committerGitHub <noreply@github.com>2021-07-02 22:20:09 -0700
commit3b94e22ad44a5921b639dfc5a59a7626562457c7 (patch)
tree6e59455df9256098b17dbcfc32e799ed00dfc50a
parente568564e2f5b462c54cb86e98bdbe2b126a480cf (diff)
downloadspack-3b94e22ad44a5921b639dfc5a59a7626562457c7.tar.gz
spack-3b94e22ad44a5921b639dfc5a59a7626562457c7.tar.bz2
spack-3b94e22ad44a5921b639dfc5a59a7626562457c7.tar.xz
spack-3b94e22ad44a5921b639dfc5a59a7626562457c7.zip
Fix fetching for Python 3.9.6 (#24686)
When using Python 3.9.6, Spack is no longer able to fetch anything. Commands like `spack fetch` and `spack install` all break. Python 3.9.6 includes a [new change](https://github.com/python/cpython/pull/25853/files#diff-b3712475a413ec972134c0260c8f1eb1deefb66184f740ef00c37b4487ef873eR462) that means that `scheme` must be a string, it cannot be None. The solution is to use an empty string like the method default. Fixes #24644. Also see https://github.com/Homebrew/homebrew-core/pull/80175 where this issue was discovered by CI. Thanks @branchvincent for reporting such a serious issue before any actual users encountered it! Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
-rw-r--r--lib/spack/spack/util/url.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/spack/spack/util/url.py b/lib/spack/spack/util/url.py
index f8abf4fa96..141b4b8093 100644
--- a/lib/spack/spack/util/url.py
+++ b/lib/spack/spack/util/url.py
@@ -11,8 +11,8 @@ import itertools
import os.path
import re
-from six import string_types
import six.moves.urllib.parse as urllib_parse
+from six import string_types
import spack.util.path
@@ -151,21 +151,21 @@ def join(base_url, path, *extra, **kwargs):
for x in itertools.chain((base_url, path), extra)]
n = len(paths)
last_abs_component = None
- scheme = None
+ scheme = ''
for i in range(n - 1, -1, -1):
obj = urllib_parse.urlparse(
- paths[i], scheme=None, allow_fragments=False)
+ paths[i], scheme='', allow_fragments=False)
scheme = obj.scheme
# in either case the component is absolute
- if scheme is not None or obj.path.startswith('/'):
- if scheme is None:
+ if scheme or obj.path.startswith('/'):
+ if not scheme:
# Without a scheme, we have to go back looking for the
# next-last component that specifies a scheme.
for j in range(i - 1, -1, -1):
obj = urllib_parse.urlparse(
- paths[j], scheme=None, allow_fragments=False)
+ paths[j], scheme='', allow_fragments=False)
if obj.scheme:
paths[i] = '{SM}://{NL}{PATH}'.format(