mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-06 14:04:12 +00:00
nem sei pq tantos arquivos
This commit is contained in:
@@ -1,16 +1,22 @@
|
||||
import importlib.util
|
||||
import os
|
||||
import sys
|
||||
from collections import namedtuple
|
||||
from typing import Any, List, Optional
|
||||
|
||||
from pip._vendor import tomli
|
||||
from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
|
||||
if sys.version_info >= (3, 11):
|
||||
import tomllib
|
||||
else:
|
||||
from pip._vendor import tomli as tomllib
|
||||
|
||||
from pip._vendor.packaging.requirements import InvalidRequirement
|
||||
|
||||
from pip._internal.exceptions import (
|
||||
InstallationError,
|
||||
InvalidPyProjectBuildRequires,
|
||||
MissingPyProjectBuildRequires,
|
||||
)
|
||||
from pip._internal.utils.packaging import get_requirement
|
||||
|
||||
|
||||
def _is_list_of_str(obj: Any) -> bool:
|
||||
@@ -61,13 +67,13 @@ def load_pyproject_toml(
|
||||
|
||||
if has_pyproject:
|
||||
with open(pyproject_toml, encoding="utf-8") as f:
|
||||
pp_toml = tomli.loads(f.read())
|
||||
pp_toml = tomllib.loads(f.read())
|
||||
build_system = pp_toml.get("build-system")
|
||||
else:
|
||||
build_system = None
|
||||
|
||||
# The following cases must use PEP 517
|
||||
# We check for use_pep517 being non-None and falsey because that means
|
||||
# We check for use_pep517 being non-None and falsy because that means
|
||||
# the user explicitly requested --no-use-pep517. The value 0 as
|
||||
# opposed to False can occur when the value is provided via an
|
||||
# environment variable or config file option (due to the quirk of
|
||||
@@ -91,14 +97,19 @@ def load_pyproject_toml(
|
||||
# If we haven't worked out whether to use PEP 517 yet,
|
||||
# and the user hasn't explicitly stated a preference,
|
||||
# we do so if the project has a pyproject.toml file
|
||||
# or if we cannot import setuptools.
|
||||
# or if we cannot import setuptools or wheels.
|
||||
|
||||
# We fallback to PEP 517 when without setuptools,
|
||||
# We fallback to PEP 517 when without setuptools or without the wheel package,
|
||||
# so setuptools can be installed as a default build backend.
|
||||
# For more info see:
|
||||
# https://discuss.python.org/t/pip-without-setuptools-could-the-experience-be-improved/11810/9
|
||||
# https://github.com/pypa/pip/issues/8559
|
||||
elif use_pep517 is None:
|
||||
use_pep517 = has_pyproject or not importlib.util.find_spec("setuptools")
|
||||
use_pep517 = (
|
||||
has_pyproject
|
||||
or not importlib.util.find_spec("setuptools")
|
||||
or not importlib.util.find_spec("wheel")
|
||||
)
|
||||
|
||||
# At this point, we know whether we're going to use PEP 517.
|
||||
assert use_pep517 is not None
|
||||
@@ -118,7 +129,7 @@ def load_pyproject_toml(
|
||||
# a version of setuptools that supports that backend.
|
||||
|
||||
build_system = {
|
||||
"requires": ["setuptools>=40.8.0", "wheel"],
|
||||
"requires": ["setuptools>=40.8.0"],
|
||||
"build-backend": "setuptools.build_meta:__legacy__",
|
||||
}
|
||||
|
||||
@@ -146,7 +157,7 @@ def load_pyproject_toml(
|
||||
# Each requirement must be valid as per PEP 508
|
||||
for requirement in requires:
|
||||
try:
|
||||
Requirement(requirement)
|
||||
get_requirement(requirement)
|
||||
except InvalidRequirement as error:
|
||||
raise InvalidPyProjectBuildRequires(
|
||||
package=req_name,
|
||||
|
||||
Reference in New Issue
Block a user