Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/pip/_internal/models/index.py @ 1:56ad4e20f292 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
| author | guerler |
|---|---|
| date | Fri, 31 Jul 2020 00:32:28 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:d30785e31577 | 1:56ad4e20f292 |
|---|---|
| 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 ) |
