mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge pull request #807 from techalchemy/non-editable-vcs-fix
Non editable vcs fix
This commit is contained in:
+1
-1
@@ -1800,7 +1800,7 @@ def install(
|
||||
# Warn if --editable wasn't passed.
|
||||
converted = convert_deps_from_pip(package_name)
|
||||
key = [k for k in converted.keys()][0]
|
||||
if is_vcs(converted[key]) and not converted[key].get('editable'):
|
||||
if is_vcs(key) or is_vcs(converted[key]) and not converted[key].get('editable'):
|
||||
click.echo(
|
||||
'{0}: You installed a VCS dependency in non–editable mode. '
|
||||
'This will work fine, but sub-depdendencies will not be resolved by {1}.'
|
||||
|
||||
+24
-32
@@ -51,6 +51,26 @@ class Project(object):
|
||||
|
||||
return os.sep.join([self._original_dir, p])
|
||||
|
||||
def _build_package_list(self, package_section):
|
||||
"""Returns a list of packages for pip-tools to consume."""
|
||||
ps = {}
|
||||
for k, v in self.parsed_pipfile.get(package_section, {}).items():
|
||||
# Skip editable VCS deps.
|
||||
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):
|
||||
if 'editable' not in v:
|
||||
continue
|
||||
else:
|
||||
ps.update({k: v})
|
||||
else:
|
||||
if 'file' not in v and not is_vcs(v) and not is_vcs(k):
|
||||
ps.update({k: v})
|
||||
else:
|
||||
if not is_vcs(k):
|
||||
ps.update({k: v})
|
||||
return ps
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._name is None:
|
||||
@@ -301,7 +321,7 @@ class Project(object):
|
||||
"""Returns a list of VCS packages, for not pip-tools to consume."""
|
||||
ps = {}
|
||||
for k, v in self.parsed_pipfile.get('packages', {}).items():
|
||||
if is_vcs(v):
|
||||
if is_vcs(v) or is_vcs(k):
|
||||
ps.update({k: v})
|
||||
return ps
|
||||
|
||||
@@ -310,7 +330,7 @@ class Project(object):
|
||||
"""Returns a list of VCS packages, for not pip-tools to consume."""
|
||||
ps = {}
|
||||
for k, v in self.parsed_pipfile.get('dev-packages', {}).items():
|
||||
if is_vcs(v):
|
||||
if is_vcs(v) or is_vcs(k):
|
||||
ps.update({k: v})
|
||||
return ps
|
||||
|
||||
@@ -324,40 +344,12 @@ class Project(object):
|
||||
@property
|
||||
def packages(self):
|
||||
"""Returns a list of packages, for pip-tools to consume."""
|
||||
ps = {}
|
||||
for k, v in self.parsed_pipfile.get('packages', {}).items():
|
||||
# Skip editable VCS deps.
|
||||
if hasattr(v, 'keys'):
|
||||
if is_vcs(v):
|
||||
if 'editable' not in v:
|
||||
continue
|
||||
else:
|
||||
ps.update({k: v})
|
||||
else:
|
||||
if 'file' not in v:
|
||||
ps.update({k: v})
|
||||
else:
|
||||
ps.update({k: v})
|
||||
return ps
|
||||
return self._build_package_list('packages')
|
||||
|
||||
@property
|
||||
def dev_packages(self):
|
||||
"""Returns a list of dev-packages, for pip-tools to consume."""
|
||||
ps = {}
|
||||
for k, v in self.parsed_pipfile.get('dev-packages', {}).items():
|
||||
# Skip editable VCS deps.
|
||||
if hasattr(v, 'keys'):
|
||||
if is_vcs(v):
|
||||
if 'editable' not in v:
|
||||
continue
|
||||
else:
|
||||
ps.update({k: v})
|
||||
else:
|
||||
if 'file' not in v:
|
||||
ps.update({k: v})
|
||||
else:
|
||||
ps.update({k: v})
|
||||
return ps
|
||||
return self._build_package_list('dev-packages')
|
||||
|
||||
def touch_pipfile(self):
|
||||
"""Simply touches the Pipfile, for later use."""
|
||||
|
||||
@@ -714,6 +714,8 @@ def is_vcs(pipfile_entry):
|
||||
|
||||
if hasattr(pipfile_entry, 'keys'):
|
||||
return any(key for key in pipfile_entry.keys() if key in VCS_LIST)
|
||||
elif isinstance(pipfile_entry, six.string_types):
|
||||
return pipfile_entry.startswith(VCS_LIST)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user