mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix editable package filtering logic
Pipfile entry values can be strings; need to check if they actually have a "get" method before accessing. Also extract the logic into utils.py so it lives with other functions similar to it.
This commit is contained in:
+11
-14
@@ -19,16 +19,15 @@ from .utils import (
|
||||
pep423_name,
|
||||
recase_file,
|
||||
find_requirements,
|
||||
is_editable,
|
||||
is_file,
|
||||
is_vcs,
|
||||
python_version,
|
||||
cleanup_toml,
|
||||
is_installable_file,
|
||||
is_valid_url,
|
||||
normalize_drive,
|
||||
python_version,
|
||||
escape_grouped_arguments,
|
||||
VCS_LIST,
|
||||
)
|
||||
from .environments import (
|
||||
PIPENV_MAX_DEPTH,
|
||||
@@ -420,22 +419,20 @@ class Project(object):
|
||||
|
||||
@property
|
||||
def editable_packages(self):
|
||||
packages = {}
|
||||
for k, v in self.parsed_pipfile.get('packages', {}).items():
|
||||
if v.get('editable') and any(
|
||||
v.get(key) for key in ('file', 'path') + VCS_LIST
|
||||
):
|
||||
packages.update({k: v})
|
||||
packages = {
|
||||
k: v
|
||||
for k, v in self.parsed_pipfile.get('packages', {}).items()
|
||||
if is_editable(v)
|
||||
}
|
||||
return packages
|
||||
|
||||
@property
|
||||
def editable_dev_packages(self):
|
||||
packages = {}
|
||||
for k, v in self.parsed_pipfile.get('dev-packages', {}).items():
|
||||
if v.get('editable') and any(
|
||||
v.get(key) for key in ('file', 'path') + VCS_LIST
|
||||
):
|
||||
packages.update({k: v})
|
||||
packages = {
|
||||
k: v
|
||||
for k, v in self.parsed_pipfile.get('dev-packages', {}).items()
|
||||
if is_editable(v)
|
||||
}
|
||||
return packages
|
||||
|
||||
@property
|
||||
|
||||
@@ -751,6 +751,14 @@ def clean_git_uri(uri):
|
||||
return uri
|
||||
|
||||
|
||||
def is_editable(pipfile_entry):
|
||||
if hasattr(pipfile_entry, 'get'):
|
||||
return pipfile_entry.get('editable', False) and any(
|
||||
pipfile_entry.get(key) for key in ('file', 'path') + VCS_LIST
|
||||
)
|
||||
return False
|
||||
|
||||
|
||||
def is_vcs(pipfile_entry):
|
||||
import requirements
|
||||
|
||||
|
||||
Reference in New Issue
Block a user