Skip to content

Commit

Permalink
Update requirementslib
Browse files Browse the repository at this point in the history
- Fix subdirectory issue

Signed-off-by: Dan Ryan <dan@danryan.co>
  • Loading branch information
techalchemy committed Oct 29, 2018
1 parent b41bcfd commit c0fdd8a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,8 @@ def pip_install(
write_to_tmpfile = False
if requirement:
needs_hashes = not requirement.editable and not ignore_hashes and r is None
write_to_tmpfile = needs_hashes
has_subdir = requirement.editable and requirement.req.subdirectory
write_to_tmpfile = needs_hashes or has_subdir

if not trusted_hosts:
trusted_hosts = []
Expand Down
2 changes: 2 additions & 0 deletions pipenv/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def default(self, obj):

if isinstance(obj, (ContainerElement, TokenElement)):
return obj.primitive_value
elif isinstance(obj, vistir.compat.Path):
obj = obj.as_posix()
return super(_LockFileEncoder, self).default(obj)

def encode(self, obj):
Expand Down
18 changes: 15 additions & 3 deletions pipenv/vendor/requirementslib/models/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,27 @@ def get_checkout_dir(self, src_dir=None):
def get_vcs_repo(self, src_dir=None):
from .vcs import VCSRepository
checkout_dir = self.get_checkout_dir(src_dir=src_dir)
url = "{0}#egg={1}".format(self.link.url_without_fragment, self.name)
link = build_vcs_link(
self.vcs,
self.uri,
name=self.name,
ref=self.ref,
subdirectory=self.subdirectory,
extras=self.extras
)
vcsrepo = VCSRepository(
url=url,
url=link.url,
name=self.name,
ref=self.ref if self.ref else None,
checkout_directory=checkout_dir,
vcs_type=self.vcs
)
if not self.is_local:
vcsrepo.obtain()
if self.subdirectory:
self.setup_path = Path(checkout_dir) / self.subdirectory / "setup.py"
else:
self.setup_path = Path(checkout_dir) / "setup.py"
return vcsrepo

def get_commit_hash(self):
Expand All @@ -612,6 +623,7 @@ def update_repo(self, src_dir=None, ref=None):
if not self.is_local and ref is not None:
self.repo.checkout_ref(ref)
repo_hash = self.repo.get_commit_hash()
self.req.revision = repo_hash
return repo_hash

@contextmanager
Expand Down Expand Up @@ -1069,7 +1081,7 @@ def as_ireq(self):
if self.editable or self.req.editable:
if ireq_line.startswith("-e "):
ireq_line = ireq_line[len("-e "):]
with ensure_setup_py(self.req.path):
with ensure_setup_py(self.req.setup_path):
ireq = ireq_from_editable(ireq_line)
else:
ireq = ireq_from_line(ireq_line)
Expand Down
1 change: 1 addition & 0 deletions pipenv/vendor/requirementslib/models/vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class VCSRepository(object):
name = attr.ib()
checkout_directory = attr.ib()
vcs_type = attr.ib()
subdirectory = attr.ib(default=None)
commit_sha = attr.ib(default=None)
ref = attr.ib(default=None)
repo_instance = attr.ib()
Expand Down

0 comments on commit c0fdd8a

Please sign in to comment.