Skip installable directories during locking

- Re-add non-editable setuptools-installable directory paths to the
exclusion list for Project package generation
- This is used to generate package lists for pip-tools
This commit is contained in:
Dan Ryan
2017-12-01 20:48:12 -05:00
parent c92e331cc8
commit 9b4f1c8d2e
2 changed files with 5 additions and 6 deletions
+4 -5
View File
@@ -62,13 +62,12 @@ class Project(object):
if hasattr(v, 'keys'):
# When a vcs url is gven without editable it only appears as a key
# Eliminate any vcs, path, or url entries which are not editable
# Since pip-tools can't do deep resolution on them
# Exempt setuptools-installable directories
if (is_vcs(v) or is_vcs(k) or (is_installable_file(k) and os.path.isfile(k)) or
# Since pip-tools can't do deep resolution on them, even setuptools-installable ones
if (is_vcs(v) or is_vcs(k) or (is_installable_file(k) or is_installable_file(v)) or
any((prefix in v and
(os.path.isfile(v[prefix]) or is_valid_url(v[prefix])))
for prefix in ['path', 'file'])):
# Non-editable VCS entries can't be resolved by piptools
# If they are editable, do resolve them
if 'editable' not in v:
continue
else:
@@ -82,7 +81,7 @@ class Project(object):
if not (any(is_vcs(i) for i in [k, v]) or
# Then exclude any installable files that are not directories
# Because pip-tools can resolve setup.py for example
any((is_installable_file(i) and os.path.isfile(i)) for i in [k, v]) or
any(is_installable_file(i) for i in [k, v]) or
# Then exclude any URLs because they need to be editable also
# Things that are excluded can only be 'shallow resolved'
any(is_valid_url(i) for i in [k, v])):
+1 -1
View File
@@ -304,7 +304,7 @@ def get_requirement(dep):
# Only parse if it is a file or an installable dir
if dep_path.is_file() or (dep_path.is_dir() and pip.utils.is_installable_dir(dep)):
if dep_path.is_absolute() or dep_path.as_posix() == '.':
path = dep
path = dep_path.as_posix()
else:
path = get_converted_relative_path(dep)
dep = dep_path.resolve().as_uri()