Eliminado venv y www del repositorio, agrege un requirements igual
This commit is contained in:
@@ -3,14 +3,16 @@ from __future__ import absolute_import
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
from collections import namedtuple
|
||||
|
||||
from pip._vendor import pytoml, six
|
||||
from pip._vendor import six, toml
|
||||
from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
|
||||
|
||||
from pip._internal.exceptions import InstallationError
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import Any, Tuple, Optional, List
|
||||
from typing import Any, Optional, List
|
||||
|
||||
|
||||
def _is_list_of_str(obj):
|
||||
@@ -21,9 +23,9 @@ def _is_list_of_str(obj):
|
||||
)
|
||||
|
||||
|
||||
def make_pyproject_path(setup_py_dir):
|
||||
def make_pyproject_path(unpacked_source_directory):
|
||||
# type: (str) -> str
|
||||
path = os.path.join(setup_py_dir, 'pyproject.toml')
|
||||
path = os.path.join(unpacked_source_directory, 'pyproject.toml')
|
||||
|
||||
# Python2 __file__ should not be unicode
|
||||
if six.PY2 and isinstance(path, six.text_type):
|
||||
@@ -32,13 +34,18 @@ def make_pyproject_path(setup_py_dir):
|
||||
return path
|
||||
|
||||
|
||||
BuildSystemDetails = namedtuple('BuildSystemDetails', [
|
||||
'requires', 'backend', 'check', 'backend_path'
|
||||
])
|
||||
|
||||
|
||||
def load_pyproject_toml(
|
||||
use_pep517, # type: Optional[bool]
|
||||
pyproject_toml, # type: str
|
||||
setup_py, # type: str
|
||||
req_name # type: str
|
||||
):
|
||||
# type: (...) -> Optional[Tuple[List[str], str, List[str]]]
|
||||
# type: (...) -> Optional[BuildSystemDetails]
|
||||
"""Load the pyproject.toml file.
|
||||
|
||||
Parameters:
|
||||
@@ -56,6 +63,8 @@ def load_pyproject_toml(
|
||||
name of PEP 517 backend,
|
||||
requirements we should check are installed after setting
|
||||
up the build environment
|
||||
directory paths to import the backend from (backend-path),
|
||||
relative to the project root.
|
||||
)
|
||||
"""
|
||||
has_pyproject = os.path.isfile(pyproject_toml)
|
||||
@@ -63,7 +72,7 @@ def load_pyproject_toml(
|
||||
|
||||
if has_pyproject:
|
||||
with io.open(pyproject_toml, encoding="utf-8") as f:
|
||||
pp_toml = pytoml.load(f)
|
||||
pp_toml = toml.load(f)
|
||||
build_system = pp_toml.get("build-system")
|
||||
else:
|
||||
build_system = None
|
||||
@@ -150,7 +159,23 @@ def load_pyproject_toml(
|
||||
reason="'build-system.requires' is not a list of strings.",
|
||||
))
|
||||
|
||||
# Each requirement must be valid as per PEP 508
|
||||
for requirement in requires:
|
||||
try:
|
||||
Requirement(requirement)
|
||||
except InvalidRequirement:
|
||||
raise InstallationError(
|
||||
error_template.format(
|
||||
package=req_name,
|
||||
reason=(
|
||||
"'build-system.requires' contains an invalid "
|
||||
"requirement: {!r}".format(requirement)
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
backend = build_system.get("build-backend")
|
||||
backend_path = build_system.get("backend-path", [])
|
||||
check = [] # type: List[str]
|
||||
if backend is None:
|
||||
# If the user didn't specify a backend, we assume they want to use
|
||||
@@ -168,4 +193,4 @@ def load_pyproject_toml(
|
||||
backend = "setuptools.build_meta:__legacy__"
|
||||
check = ["setuptools>=40.8.0", "wheel"]
|
||||
|
||||
return (requires, backend, check)
|
||||
return BuildSystemDetails(requires, backend, check, backend_path)
|
||||
|
||||
Reference in New Issue
Block a user