Skip to content

Commit

Permalink
Only strip VCS prefix for URIs with vcs+ patterns
Browse files Browse the repository at this point in the history
- Fixes #1126
- Does a simple check before stripping the VCS prefix on
a requirement.uri in pipenv.utils.convert_deps_from_pip
  • Loading branch information
techalchemy committed Nov 27, 2017
1 parent 8a88029 commit c9ae370
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

# List of version control systems we support.
VCS_LIST = ('git', 'svn', 'hg', 'bzr')
SCHEME_LIST = ('http://', 'https://', 'ftp://', 'file://')
SCHEME_LIST = ('http://', 'https://', 'ftp://', 'file://', 'git://')

requests = requests.Session()

Expand Down Expand Up @@ -661,8 +661,10 @@ def convert_deps_from_pip(dep):
req.path = None

# Crop off the git+, etc part.
dependency.setdefault(req.name, {}).update({req.vcs: req.uri[len(req.vcs) + 1:]})

if '+' in req.uri:
req.uri = req.uri[len(req.vcs) + 1:]
dependency.setdefault(req.name, {}).update({req.vcs: req.uri})
print('dependency: {}'.format(dependency))
# Add --editable, if it's there.
if req.editable:
dependency[req.name].update({'editable': True})
Expand Down
13 changes: 13 additions & 0 deletions tests/test_pipenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,19 @@ def test_specific_package_environment_markers(self):
c = p.pipenv('run python -c "import requests;"')
assert c.return_code == 1

@pytest.mark.install
@pytest.mark.vcs
@pytest.mark.tablib
def test_install_editable_git_tag(self):
with PipenvInstance() as p:
c = p.pipenv('install -e git+git://github.com/kennethreitz/tablib.git@v0.12.1#egg=tablib')
assert c.return_code == 0
assert 'tablib' in p.pipfile['packages']
assert 'tablib' in p.lockfile['default']
assert 'git' in p.lockfile['default']['tablib']
assert p.lockfile['default']['tablib']['git'] == 'git://github.com/kennethreitz/tablib.git'
assert 'ref' in p.lockfile['default']['tablib']

@pytest.mark.run
@pytest.mark.alt
@pytest.mark.install
Expand Down

0 comments on commit c9ae370

Please sign in to comment.