From 13e9e6dd7c9b31f5f8df2488a861a10ae8b7305c Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Wed, 4 Oct 2017 23:32:19 -0400 Subject: [PATCH 1/3] Modify Requirement objects using git over ssh * Fix Requirement objects that use git+git@host:user/repo.git syntax * Requirements are not natively being recognized as VCS requirements * This converts them to VCS by moving req.path to req.uri and adding * Adds req.vcs flag * Remove some redundancies from project package filtering * Fixes #788 (Maybe) -- see discussion in the issue --- pipenv/project.py | 5 +++-- pipenv/utils.py | 12 ++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pipenv/project.py b/pipenv/project.py index 4f65ad53..d4505a20 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -60,15 +60,16 @@ class Project(object): if hasattr(v, 'keys'): # When a vcs url is gven without editable it only appears as a key if is_vcs(v) or is_vcs(k): + # Non-editable VCS entries can't be resolved by piptools if 'editable' not in v: continue else: ps.update({k: v}) else: - if not is_file(v) and not is_file(k) and not is_vcs(v) and not is_vcs(k): + if not is_file(v) and not is_file(k): ps.update({k: v}) else: - if not is_vcs(k) and not is_file(k): + if not is_vcs(k) and not is_file(k) and not is_vcs(v): ps.update({k: v}) return ps diff --git a/pipenv/utils.py b/pipenv/utils.py index 2047bddd..ebc303ac 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -495,6 +495,8 @@ def convert_deps_from_pip(dep): req = [r for r in requirements.parse(dep)][0] extras = {'extras': req.extras} + + # File installs. if (req.uri or (os.path.exists(req.path) if req.path else False) or @@ -517,8 +519,8 @@ def convert_deps_from_pip(dep): if req.editable: dependency[req.name].update({'editable': True}) - # VCS Installs. - if req.vcs: + # VCS Installs. Extra check for unparsed git over SSH + if req.vcs or is_vcs(req.path): if req.name is None: raise ValueError('pipenv requires an #egg fragment for version controlled ' 'dependencies. Please install remote dependency ' @@ -528,6 +530,12 @@ def convert_deps_from_pip(dep): if req.extras: dependency[req.name] = extras + # Set up this requirement as a proper VCS requirement if it was not + if not req.vcs and req.path.startswith(VCS_LIST): + req.vcs = [vcs for vcs in VCS_LIST if req.path.startswith(vcs)][0] + req.uri = '{0}'.format(req.path) #.replace(':', '/', 1).replace('@', '://', 1) + req.path = None + # Crop off the git+, etc part. dependency.setdefault(req.name, {}).update({req.vcs: req.uri[len(req.vcs) + 1:]}) From fc2bb6b9cc6f58690b47a713495c800d73bbaeb0 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Wed, 4 Oct 2017 23:39:47 -0400 Subject: [PATCH 2/3] Remove extra whitespace --- pipenv/utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pipenv/utils.py b/pipenv/utils.py index ebc303ac..b759ce0b 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -495,8 +495,7 @@ def convert_deps_from_pip(dep): req = [r for r in requirements.parse(dep)][0] extras = {'extras': req.extras} - - + # File installs. if (req.uri or (os.path.exists(req.path) if req.path else False) or From c8db3a501b57026693b4a244c024fde9512fbfa5 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Wed, 4 Oct 2017 23:41:24 -0400 Subject: [PATCH 3/3] Remove URL reformatter --- pipenv/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/utils.py b/pipenv/utils.py index b759ce0b..94b6fdec 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -532,7 +532,7 @@ def convert_deps_from_pip(dep): # Set up this requirement as a proper VCS requirement if it was not if not req.vcs and req.path.startswith(VCS_LIST): req.vcs = [vcs for vcs in VCS_LIST if req.path.startswith(vcs)][0] - req.uri = '{0}'.format(req.path) #.replace(':', '/', 1).replace('@', '://', 1) + req.uri = '{0}'.format(req.path) req.path = None # Crop off the git+, etc part.