Mercurial > repos > guerler > hhblits
annotate 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 |
rev | line source |
---|---|
0
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
1 from pip._vendor.six.moves.urllib import parse as urllib_parse |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
2 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
3 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
4 class PackageIndex(object): |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
5 """Represents a Package Index and provides easier access to endpoints |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
6 """ |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
7 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
8 def __init__(self, url, file_storage_domain): |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
9 # type: (str, str) -> None |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
10 super(PackageIndex, self).__init__() |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
11 self.url = url |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
12 self.netloc = urllib_parse.urlsplit(url).netloc |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
13 self.simple_url = self._url_for_path('simple') |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
14 self.pypi_url = self._url_for_path('pypi') |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
15 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
16 # This is part of a temporary hack used to block installs of PyPI |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
17 # packages which depend on external urls only necessary until PyPI can |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
18 # block such packages themselves |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
19 self.file_storage_domain = file_storage_domain |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
20 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
21 def _url_for_path(self, path): |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
22 # type: (str) -> str |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
23 return urllib_parse.urljoin(self.url, path) |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
24 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
25 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
26 PyPI = PackageIndex( |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
27 'https://pypi.org/', file_storage_domain='files.pythonhosted.org' |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
28 ) |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
29 TestPyPI = PackageIndex( |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
30 'https://test.pypi.org/', file_storage_domain='test-files.pythonhosted.org' |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
31 ) |