Mercurial > repos > guerler > hhblits
comparison lib/python3.8/site-packages/pip/_internal/models/index.py @ 0:9e54283cc701 draft
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
author | guerler |
---|---|
date | Mon, 27 Jul 2020 03:47:31 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9e54283cc701 |
---|---|
1 from pip._vendor.six.moves.urllib import parse as urllib_parse | |
2 | |
3 | |
4 class PackageIndex(object): | |
5 """Represents a Package Index and provides easier access to endpoints | |
6 """ | |
7 | |
8 def __init__(self, url, file_storage_domain): | |
9 # type: (str, str) -> None | |
10 super(PackageIndex, self).__init__() | |
11 self.url = url | |
12 self.netloc = urllib_parse.urlsplit(url).netloc | |
13 self.simple_url = self._url_for_path('simple') | |
14 self.pypi_url = self._url_for_path('pypi') | |
15 | |
16 # This is part of a temporary hack used to block installs of PyPI | |
17 # packages which depend on external urls only necessary until PyPI can | |
18 # block such packages themselves | |
19 self.file_storage_domain = file_storage_domain | |
20 | |
21 def _url_for_path(self, path): | |
22 # type: (str) -> str | |
23 return urllib_parse.urljoin(self.url, path) | |
24 | |
25 | |
26 PyPI = PackageIndex( | |
27 'https://pypi.org/', file_storage_domain='files.pythonhosted.org' | |
28 ) | |
29 TestPyPI = PackageIndex( | |
30 'https://test.pypi.org/', file_storage_domain='test-files.pythonhosted.org' | |
31 ) |