mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Update resolve() calls and requirementslib
- Accommodate ramdisks Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
+6
-4
@@ -214,7 +214,6 @@ class FileRequirement(BaseRequirement):
|
||||
|
||||
return LinkInfo(vcs_type, prefer, relpath, path, uri, link)
|
||||
|
||||
|
||||
@uri.default
|
||||
def get_uri(self):
|
||||
if self.path and not self.uri:
|
||||
@@ -231,7 +230,7 @@ class FileRequirement(BaseRequirement):
|
||||
return self.link.egg_fragment
|
||||
elif self.link and self.link.is_wheel:
|
||||
return Wheel(self.link.filename).name
|
||||
if self._uri_scheme != "uri" and self.path and self.setup_path.exists():
|
||||
if self._uri_scheme != "uri" and self.path and is_installable_file(self.path) and self.setup_path.exists():
|
||||
from distutils.core import run_setup
|
||||
|
||||
try:
|
||||
@@ -320,7 +319,10 @@ class FileRequirement(BaseRequirement):
|
||||
"Supplied requirement is not installable: {0!r}".format(line)
|
||||
)
|
||||
vcs_type, prefer, relpath, path, uri, link = cls.get_link_from_line(line)
|
||||
setup_path = Path(path) / "setup.py" if path else None
|
||||
if path:
|
||||
setup_path = Path(path) / "setup.py"
|
||||
if not setup_path.exists():
|
||||
setup_path = None
|
||||
arg_dict = {
|
||||
"path": relpath or path,
|
||||
"uri": unquote(link.url_without_fragment),
|
||||
@@ -392,7 +394,7 @@ class FileRequirement(BaseRequirement):
|
||||
|
||||
@property
|
||||
def pipfile_part(self):
|
||||
pipfile_dict = {k: v for k, v in attr.asdict(self, filter=filter_none).items()}
|
||||
pipfile_dict = attr.asdict(self, filter=filter_none).copy()
|
||||
name = pipfile_dict.pop("name")
|
||||
if '_uri_scheme' in pipfile_dict:
|
||||
pipfile_dict.pop('_uri_scheme')
|
||||
|
||||
+2
-3
@@ -79,7 +79,7 @@ def get_version(pipfile_entry):
|
||||
def strip_ssh_from_git_uri(uri):
|
||||
"""Return git+ssh:// formatted URI to git+git@ format"""
|
||||
if isinstance(uri, six.string_types):
|
||||
uri = uri.replace("git+ssh://", "git+", 1)
|
||||
uri = uri.replace("git+ssh://", "git+")
|
||||
return uri
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ def add_ssh_scheme_to_git_uri(uri):
|
||||
if isinstance(uri, six.string_types):
|
||||
# Add scheme for parsing purposes, this is also what pip does
|
||||
if uri.startswith("git+") and "://" not in uri:
|
||||
uri = uri.replace("git+", "git+ssh://")
|
||||
uri = uri.replace("git+", "git+ssh://", 1)
|
||||
return uri
|
||||
|
||||
|
||||
@@ -120,7 +120,6 @@ def validate_vcs(instance, attr_, value):
|
||||
|
||||
|
||||
def validate_path(instance, attr_, value):
|
||||
return True
|
||||
if not os.path.exists(value):
|
||||
raise ValueError("Invalid path {0!r}", format(value))
|
||||
|
||||
|
||||
+5
-1
@@ -64,7 +64,11 @@ def is_vcs(pipfile_entry):
|
||||
|
||||
def get_converted_relative_path(path, relative_to=os.curdir):
|
||||
"""Given a vague relative path, return the path relative to the given location"""
|
||||
start = Path(relative_to).resolve()
|
||||
start = Path(relative_to)
|
||||
try:
|
||||
start = start.resolve()
|
||||
except OSError:
|
||||
start = start.absolute()
|
||||
path = start.joinpath('.', path).relative_to(start)
|
||||
# Normalize these to use forward slashes even on windows
|
||||
if os.name == 'nt':
|
||||
|
||||
@@ -50,7 +50,11 @@ class _PipenvInstance(object):
|
||||
self.original_umask = os.umask(0o007)
|
||||
self.original_dir = os.path.abspath(os.curdir)
|
||||
self._path = TemporaryDirectory(suffix='-project', prefix='pipenv-')
|
||||
self.path = str(Path(self._path.name).resolve())
|
||||
path = Path(self._path.name)
|
||||
try:
|
||||
self.path = str(path.resolve())
|
||||
except OSError:
|
||||
self.path = str(path.absolute())
|
||||
# set file creation perms
|
||||
self.pipfile_path = None
|
||||
self.chdir = chdir
|
||||
|
||||
@@ -47,8 +47,11 @@ def test_file_urls_work(PipenvInstance, pypi):
|
||||
whl = (
|
||||
Path(__file__).parent.parent
|
||||
.joinpath('pypi', 'six', 'six-1.11.0-py2.py3-none-any.whl')
|
||||
.resolve()
|
||||
)
|
||||
try:
|
||||
whl = whl.resolve()
|
||||
except OSError:
|
||||
whl = whl.absolute()
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
c = p.pipenv('install "{0}"'.format(whl.as_uri()))
|
||||
assert c.return_code == 0
|
||||
|
||||
@@ -35,8 +35,11 @@ def test_local_path_windows(PipenvInstance, pypi):
|
||||
whl = (
|
||||
pathlib.Path(__file__).parent.parent
|
||||
.joinpath('pypi', 'six', 'six-1.11.0-py2.py3-none-any.whl')
|
||||
.resolve()
|
||||
)
|
||||
try:
|
||||
whl = whl.resolve()
|
||||
except OSError:
|
||||
whl = whl.absolute()
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
c = p.pipenv('install "{0}"'.format(whl))
|
||||
assert c.return_code == 0
|
||||
@@ -47,8 +50,11 @@ def test_local_path_windows_forward_slash(PipenvInstance, pypi):
|
||||
whl = (
|
||||
pathlib.Path(__file__).parent.parent
|
||||
.joinpath('pypi', 'six', 'six-1.11.0-py2.py3-none-any.whl')
|
||||
.resolve()
|
||||
)
|
||||
try:
|
||||
whl = whl.resolve()
|
||||
except OSError:
|
||||
whl = whl.absolute()
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
c = p.pipenv('install "{0}"'.format(whl.as_posix()))
|
||||
assert c.return_code == 0
|
||||
|
||||
Reference in New Issue
Block a user