diff options
author | Tarek Ziade <tarek@ziade.org> | 2011-05-21 22:47:40 +0200 |
---|---|---|
committer | Tarek Ziade <tarek@ziade.org> | 2011-05-21 22:47:40 +0200 |
commit | cc243cc8085ffd7b184d52e9250b64d8ee3eb1a0 (patch) | |
tree | 70c4c24bbabc8e20ef22b86be989379faedd14f6 /Lib/packaging/pypi/simple.py | |
parent | 76ad4f0ec9be19ccd341bb0989d8de08671d29f5 (diff) | |
download | cpython-git-cc243cc8085ffd7b184d52e9250b64d8ee3eb1a0.tar.gz |
make sure the crawler can browse file-based indexes under win32
Diffstat (limited to 'Lib/packaging/pypi/simple.py')
-rw-r--r-- | Lib/packaging/pypi/simple.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Lib/packaging/pypi/simple.py b/Lib/packaging/pypi/simple.py index 8585193883..ee7a113754 100644 --- a/Lib/packaging/pypi/simple.py +++ b/Lib/packaging/pypi/simple.py @@ -123,8 +123,14 @@ class Crawler(BaseClient): self.follow_externals = follow_externals # mirroring attributes. - if not index_url.endswith("/"): - index_url += "/" + parsed = urllib.parse.urlparse(index_url) + self.scheme = parsed[0] + if self.scheme == 'file': + ender = os.path.sep + else: + ender = '/' + if not index_url.endswith(ender): + index_url += ender # if no mirrors are defined, use the method described in PEP 381. if mirrors is None: mirrors = get_mirrors(mirrors_url) @@ -376,7 +382,11 @@ class Crawler(BaseClient): :param name: the name of the project to find the page """ # Browse and index the content of the given PyPI page. - url = self.index_url + name + "/" + if self.scheme == 'file': + ender = os.path.sep + else: + ender = '/' + url = self.index_url + name + ender self._process_url(url, name) @socket_timeout() @@ -395,7 +405,7 @@ class Crawler(BaseClient): # add index.html automatically for filesystem paths if scheme == 'file': - if url.endswith('/'): + if url.endswith(os.path.sep): url += "index.html" # add authorization headers if auth is provided |