Eliminado venv y www del repositorio, agrege un requirements igual

This commit is contained in:
2020-11-22 21:14:46 -03:00
parent 18cf2d335a
commit 199a1e2a61
820 changed files with 15495 additions and 22017 deletions

View File

@@ -6,31 +6,33 @@ from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from pip._vendor.packaging.version import _BaseVersion
from pip._internal.models.link import Link
from typing import Any
class InstallationCandidate(KeyBasedCompareMixin):
"""Represents a potential "candidate" for installation.
"""
def __init__(self, project, version, link):
# type: (Any, str, Link) -> None
self.project = project
__slots__ = ["name", "version", "link"]
def __init__(self, name, version, link):
# type: (str, str, Link) -> None
self.name = name
self.version = parse_version(version) # type: _BaseVersion
self.link = link
super(InstallationCandidate, self).__init__(
key=(self.project, self.version, self.link),
key=(self.name, self.version, self.link),
defining_class=InstallationCandidate
)
def __repr__(self):
# type: () -> str
return "<InstallationCandidate({!r}, {!r}, {!r})>".format(
self.project, self.version, self.link,
self.name, self.version, self.link,
)
def __str__(self):
# type: () -> str
return '{!r} candidate (version {} at {})'.format(
self.project, self.version, self.link,
self.name, self.version, self.link,
)

View File

@@ -1,5 +1,6 @@
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.exceptions import CommandError
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
@@ -10,8 +11,10 @@ class FormatControl(object):
"""Helper for managing formats from which a package can be installed.
"""
__slots__ = ["no_binary", "only_binary"]
def __init__(self, no_binary=None, only_binary=None):
# type: (Optional[Set], Optional[Set]) -> None
# type: (Optional[Set[str]], Optional[Set[str]]) -> None
if no_binary is None:
no_binary = set()
if only_binary is None:
@@ -21,12 +24,24 @@ class FormatControl(object):
self.only_binary = only_binary
def __eq__(self, other):
return self.__dict__ == other.__dict__
# type: (object) -> bool
if not isinstance(other, self.__class__):
return NotImplemented
if self.__slots__ != other.__slots__:
return False
return all(
getattr(self, k) == getattr(other, k)
for k in self.__slots__
)
def __ne__(self, other):
# type: (object) -> bool
return not self.__eq__(other)
def __repr__(self):
# type: () -> str
return "{}({}, {})".format(
self.__class__.__name__,
self.no_binary,
@@ -35,7 +50,11 @@ class FormatControl(object):
@staticmethod
def handle_mutual_excludes(value, target, other):
# type: (str, Optional[Set], Optional[Set]) -> None
# type: (str, Set[str], Set[str]) -> None
if value.startswith('-'):
raise CommandError(
"--no-binary / --only-binary option requires 1 argument."
)
new = value.split(',')
while ':all:' in new:
other.clear()
@@ -54,7 +73,7 @@ class FormatControl(object):
target.add(name)
def get_allowed_formats(self, canonical_name):
# type: (str) -> FrozenSet
# type: (str) -> FrozenSet[str]
result = {"binary", "source"}
if canonical_name in self.only_binary:
result.discard('source')

View File

@@ -5,6 +5,9 @@ class PackageIndex(object):
"""Represents a Package Index and provides easier access to endpoints
"""
__slots__ = ['url', 'netloc', 'simple_url', 'pypi_url',
'file_storage_domain']
def __init__(self, url, file_storage_domain):
# type: (str, str) -> None
super(PackageIndex, self).__init__()

View File

@@ -1,18 +1,22 @@
import os
import posixpath
import re
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.utils.filetypes import WHEEL_EXTENSION
from pip._internal.utils.misc import (
WHEEL_EXTENSION, path_to_url, redact_password_from_url,
split_auth_from_netloc, splitext,
redact_auth_from_url,
split_auth_from_netloc,
splitext,
)
from pip._internal.utils.models import KeyBasedCompareMixin
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils.urls import path_to_url, url_to_path
if MYPY_CHECK_RUNNING:
from typing import Optional, Text, Tuple, Union
from pip._internal.index import HTMLPage
from pip._internal.index.collector import HTMLPage
from pip._internal.utils.hashes import Hashes
@@ -20,12 +24,22 @@ class Link(KeyBasedCompareMixin):
"""Represents a parsed link from a Package Index's simple URL
"""
__slots__ = [
"_parsed_url",
"_url",
"comes_from",
"requires_python",
"yanked_reason",
"cache_link_parsing",
]
def __init__(
self,
url, # type: str
comes_from=None, # type: Optional[Union[str, HTMLPage]]
requires_python=None, # type: Optional[str]
yanked_reason=None, # type: Optional[Text]
cache_link_parsing=True, # type: bool
):
# type: (...) -> None
"""
@@ -42,6 +56,11 @@ class Link(KeyBasedCompareMixin):
a simple repository HTML link. If the file has been yanked but
no reason was provided, this should be the empty string. See
PEP 592 for more information and the specification.
:param cache_link_parsing: A flag that is used elsewhere to determine
whether resources retrieved from this link
should be cached. PyPI index urls should
generally have this set to False, for
example.
"""
# url can be a UNC windows share
@@ -59,19 +78,23 @@ class Link(KeyBasedCompareMixin):
super(Link, self).__init__(key=url, defining_class=Link)
self.cache_link_parsing = cache_link_parsing
def __str__(self):
# type: () -> str
if self.requires_python:
rp = ' (requires-python:%s)' % self.requires_python
rp = ' (requires-python:{})'.format(self.requires_python)
else:
rp = ''
if self.comes_from:
return '%s (from %s)%s' % (redact_password_from_url(self._url),
self.comes_from, rp)
return '{} (from {}){}'.format(
redact_auth_from_url(self._url), self.comes_from, rp)
else:
return redact_password_from_url(str(self._url))
return redact_auth_from_url(str(self._url))
def __repr__(self):
return '<Link %s>' % self
# type: () -> str
return '<Link {}>'.format(self)
@property
def url(self):
@@ -90,9 +113,15 @@ class Link(KeyBasedCompareMixin):
return netloc
name = urllib_parse.unquote(name)
assert name, ('URL %r produced no filename' % self._url)
assert name, (
'URL {self._url!r} produced no filename'.format(**locals()))
return name
@property
def file_path(self):
# type: () -> str
return url_to_path(self.url)
@property
def scheme(self):
# type: () -> str
@@ -168,27 +197,29 @@ class Link(KeyBasedCompareMixin):
@property
def show_url(self):
# type: () -> Optional[str]
# type: () -> str
return posixpath.basename(self._url.split('#', 1)[0].split('?', 1)[0])
@property
def is_file(self):
# type: () -> bool
return self.scheme == 'file'
def is_existing_dir(self):
# type: () -> bool
return self.is_file and os.path.isdir(self.file_path)
@property
def is_wheel(self):
# type: () -> bool
return self.ext == WHEEL_EXTENSION
@property
def is_artifact(self):
def is_vcs(self):
# type: () -> bool
"""
Determines if this points to an actual artifact (e.g. a tarball) or if
it points to an "abstract" thing like a path or a VCS location.
"""
from pip._internal.vcs import vcs
if self.scheme in vcs.all_schemes:
return False
return True
return self.scheme in vcs.all_schemes
@property
def is_yanked(self):
@@ -197,6 +228,7 @@ class Link(KeyBasedCompareMixin):
@property
def has_hash(self):
# type: () -> bool
return self.hash_name is not None
def is_hash_allowed(self, hashes):

View File

@@ -7,8 +7,8 @@ from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.models.index import PyPI
from pip._internal.utils.compat import HAS_TLS
from pip._internal.utils.misc import normalize_path, redact_password_from_url
from pip._internal.utils.compat import has_tls
from pip._internal.utils.misc import normalize_path, redact_auth_from_url
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
@@ -24,6 +24,8 @@ class SearchScope(object):
Encapsulates the locations that pip is configured to search.
"""
__slots__ = ["find_links", "index_urls"]
@classmethod
def create(
cls,
@@ -49,7 +51,7 @@ class SearchScope(object):
# If we don't have TLS enabled, then WARN if anyplace we're looking
# relies on TLS.
if not HAS_TLS:
if not has_tls():
for link in itertools.chain(index_urls, built_find_links):
parsed = urllib_parse.urlparse(link)
if parsed.scheme == 'https':
@@ -77,15 +79,34 @@ class SearchScope(object):
def get_formatted_locations(self):
# type: () -> str
lines = []
redacted_index_urls = []
if self.index_urls and self.index_urls != [PyPI.simple_url]:
lines.append(
'Looking in indexes: {}'.format(', '.join(
redact_password_from_url(url) for url in self.index_urls))
)
for url in self.index_urls:
redacted_index_url = redact_auth_from_url(url)
# Parse the URL
purl = urllib_parse.urlsplit(redacted_index_url)
# URL is generally invalid if scheme and netloc is missing
# there are issues with Python and URL parsing, so this test
# is a bit crude. See bpo-20271, bpo-23505. Python doesn't
# always parse invalid URLs correctly - it should raise
# exceptions for malformed URLs
if not purl.scheme and not purl.netloc:
logger.warning(
'The index url "%s" seems invalid, '
'please provide a scheme.', redacted_index_url)
redacted_index_urls.append(redacted_index_url)
lines.append('Looking in indexes: {}'.format(
', '.join(redacted_index_urls)))
if self.find_links:
lines.append(
'Looking in links: {}'.format(', '.join(
redact_password_from_url(url) for url in self.find_links))
redact_auth_from_url(url) for url in self.find_links))
)
return '\n'.join(lines)
@@ -98,6 +119,7 @@ class SearchScope(object):
"""
def mkurl_pypi_url(url):
# type: (str) -> str
loc = posixpath.join(
url,
urllib_parse.quote(canonicalize_name(project_name)))

View File

@@ -6,12 +6,14 @@ if MYPY_CHECK_RUNNING:
class SelectionPreferences(object):
"""
Encapsulates the candidate selection preferences for downloading
and installing files.
"""
__slots__ = ['allow_yanked', 'allow_all_prereleases', 'format_control',
'prefer_binary', 'ignore_requires_python']
# Don't include an allow_yanked default value to make sure each call
# site considers whether yanked releases are allowed. This also causes
# that decision to be made explicit in the calling code, which helps

View File

@@ -1,12 +1,16 @@
import sys
from pip._internal.pep425tags import get_supported, version_info_to_nodot
from pip._internal.utils.compatibility_tags import (
get_supported,
version_info_to_nodot,
)
from pip._internal.utils.misc import normalize_version_info
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import List, Optional, Tuple
from pip._internal.pep425tags import Pep425Tag
from pip._vendor.packaging.tags import Tag
class TargetPython(object):
@@ -16,6 +20,16 @@ class TargetPython(object):
for a package install, download, etc.
"""
__slots__ = [
"_given_py_version_info",
"abi",
"implementation",
"platform",
"py_version",
"py_version_info",
"_valid_tags",
]
def __init__(
self,
platform=None, # type: Optional[str]
@@ -33,10 +47,10 @@ class TargetPython(object):
:param py_version_info: An optional tuple of ints representing the
Python version information to use (e.g. `sys.version_info[:3]`).
This can have length 1, 2, or 3 when provided.
:param abi: A string or None. This is passed to pep425tags.py's
:param abi: A string or None. This is passed to compatibility_tags.py's
get_supported() function as is.
:param implementation: A string or None. This is passed to
pep425tags.py's get_supported() function as is.
compatibility_tags.py's get_supported() function as is.
"""
# Store the given py_version_info for when we call get_supported().
self._given_py_version_info = py_version_info
@@ -55,7 +69,7 @@ class TargetPython(object):
self.py_version_info = py_version_info
# This is used to cache the return value of get_tags().
self._valid_tags = None # type: Optional[List[Pep425Tag]]
self._valid_tags = None # type: Optional[List[Tag]]
def format_given(self):
# type: () -> str
@@ -80,7 +94,7 @@ class TargetPython(object):
)
def get_tags(self):
# type: () -> List[Pep425Tag]
# type: () -> List[Tag]
"""
Return the supported PEP 425 tags to check wheel candidates against.
@@ -91,12 +105,12 @@ class TargetPython(object):
# versions=None uses special default logic.
py_version_info = self._given_py_version_info
if py_version_info is None:
versions = None
version = None
else:
versions = [version_info_to_nodot(py_version_info)]
version = version_info_to_nodot(py_version_info)
tags = get_supported(
versions=versions,
version=version,
platform=self.platform,
abi=self.abi,
impl=self.implementation,