Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-11-12 12:04:58 -05:00
parent 7e139ad981
commit 8502ac96ec
7 changed files with 13 additions and 20 deletions
-1
View File
@@ -448,7 +448,6 @@ class PathEntry(BasePath):
if self.is_dir:
return None
if self.is_python:
from .python import PythonVersion
try:
py_version = PythonVersion.from_path(path=self, name=self.name)
except InvalidPythonVersion:
+2 -2
View File
@@ -65,7 +65,7 @@ class Finder(object):
def which(self, exe):
return self.system_path.which(exe)
@lru_cache(maxsize=128)
@lru_cache(maxsize=1024)
def find_python_version(
self, major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None
):
@@ -113,7 +113,7 @@ class Finder(object):
major=major, minor=minor, patch=patch, pre=pre, dev=dev, arch=arch, name=name
)
@lru_cache(maxsize=128)
@lru_cache(maxsize=1024)
def find_all_python_versions(
self, major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None
):
+1 -1
View File
@@ -90,7 +90,7 @@ def looks_like_python(name):
return any(fnmatch(name, rule) for rule in MATCH_RULES)
@lru_cache(maxsize=128)
@lru_cache(maxsize=1024)
def path_is_python(path):
return path_is_executable(path) and looks_like_python(path.name)
+2 -2
View File
@@ -223,13 +223,13 @@ class Lockfile(object):
try:
projectfile = cls.load_projectfile(path, create=create)
except JSONDecodeError as e:
except JSONDecodeError:
path = os.path.abspath(path)
if not os.path.isdir(path):
path = os.path.dirname(path)
path = Path(os.path.join(path, "Pipfile.lock"))
formatted_path = path.as_posix()
backup_path = "%.bak" % formatted_path
backup_path = "%s.bak" % formatted_path
LockfileCorruptException.show(formatted_path, backup_path=backup_path)
path.rename(backup_path)
cls.load(formatted_path, create=True)
+5 -10
View File
@@ -14,7 +14,7 @@ import pip_shims
from first import first
from packaging.markers import Marker
from packaging.requirements import Requirement as PackagingRequirement
from packaging.specifiers import Specifier, SpecifierSet
from packaging.specifiers import Specifier, SpecifierSet, LegacySpecifier, InvalidSpecifier
from packaging.utils import canonicalize_name
from six.moves.urllib import parse as urllib_parse
from six.moves.urllib.parse import unquote
@@ -325,9 +325,6 @@ class FileRequirement(object):
if setup_name:
name = setup_name
self._has_hashed_name = False
version = setupinfo_dict.get("version")
if version and not self.version:
self.version = version
build_requires = setupinfo_dict.get("build_requires")
build_backend = setupinfo_dict.get("build_backend")
if build_requires and not self.pyproject_requires:
@@ -404,7 +401,6 @@ class FileRequirement(object):
cls, path=None, uri=None, editable=False, extras=None, link=None, vcs_type=None,
name=None, req=None, line=None, uri_scheme=None, setup_path=None, relpath=None
):
import pip_shims.shims
if relpath and not path:
path = relpath
if not path and uri and link.scheme == "file":
@@ -455,7 +451,6 @@ class FileRequirement(object):
creation_kwargs["vcs_type"] = vcs_type
_line = None
if not name:
import pip_shims.shims
_line = unquote(link.url_without_fragment) if link.url else uri
if editable:
ireq = pip_shims.shims.install_req_from_editable(_line)
@@ -1050,8 +1045,6 @@ class Requirement(object):
@classmethod
def from_line(cls, line):
import pip_shims.shims
if isinstance(line, pip_shims.shims.InstallRequirement):
line = format_requirement(line)
hashes = None
@@ -1200,7 +1193,6 @@ class Requirement(object):
old_name = cls_inst.req.req.name or cls_inst.req.name
if not cls_inst.is_named and not cls_inst.editable and not name:
if cls_inst.is_vcs:
import pip_shims.shims
ireq = pip_shims.shims.install_req_from_req(cls_inst.as_line(include_hashes=False))
info = SetupInfo.from_ireq(ireq)
if info is not None:
@@ -1276,7 +1268,10 @@ class Requirement(object):
return markers
def get_specifier(self):
return Specifier(self.specifiers)
try:
return Specifier(self.specifiers)
except InvalidSpecifier:
return LegacySpecifier(self.specifiers)
def get_version(self):
return pip_shims.shims.parse_version(self.get_specifier().version)
-1
View File
@@ -95,7 +95,6 @@ def build_vcs_link(vcs, uri, name=None, ref=None, subdirectory=None, extras=None
if extras:
extras = extras_to_string(extras)
uri = "{0}{1}".format(uri, extras)
# if subdirectory:
if subdirectory:
uri = "{0}&subdirectory={1}".format(uri, subdirectory)
return create_link(uri)
+3 -3
View File
@@ -21,20 +21,20 @@ pipdeptree==0.13.0
pipreqs==0.4.9
docopt==0.6.2
yarg==0.1.9
pythonfinder==1.1.7
pythonfinder==1.1.8
requests==2.20.0
chardet==3.0.4
idna==2.7
urllib3==1.24
certifi==2018.10.15
requirementslib==1.2.5
requirementslib==1.3.0
attrs==18.2.0
distlib==0.2.8
packaging==18.0
pyparsing==2.2.2
pytoml==0.1.19
plette==0.2.2
tomlkit==0.4.6
tomlkit==0.5.2
shellingham==1.2.7
six==1.11.0
semver==2.8.1