mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Resolve dependencies of local wheels
- Fixes #1937, #1683 - Modifies the resolved wheel info on the way into the lockfile to retain the relative path Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
+2
-1
@@ -3,7 +3,8 @@
|
||||
- Ensure lock hash does not change based on injected env vars.
|
||||
- Fix bug in detecting .venv at project root when in subdirectories.
|
||||
- Parse quoting in [scripts] section correctly + clearer run errors.
|
||||
- Fix bug resolving & locking markers correctly
|
||||
- Fix bug resolving & locking markers correctly
|
||||
- Resolve dependencies of wheel files.
|
||||
11.9.0:
|
||||
- Vastly improve markers capabilities.
|
||||
- Support for environment variables in Pipfiles.
|
||||
|
||||
@@ -1128,6 +1128,12 @@ def do_lock(
|
||||
# Add default dependencies to lockfile.
|
||||
for dep in results:
|
||||
# Add version information to lockfile.
|
||||
pipfile_version = project.packages[dep['name']] if dep['name'] in project.packages else None
|
||||
if pipfile_version and hasattr(pipfile_version, 'keys') and any(k for k in ['file', 'path'] if k in pipfile_version):
|
||||
lockfile['default'].update(
|
||||
{dep['name']: dict(pipfile_version)}
|
||||
)
|
||||
continue
|
||||
lockfile['default'].update(
|
||||
{dep['name']: {'version': '=={0}'.format(dep['version'])}}
|
||||
)
|
||||
|
||||
@@ -120,7 +120,7 @@ class Resolver(object):
|
||||
@staticmethod
|
||||
def check_constraints(constraints):
|
||||
for constraint in constraints:
|
||||
if constraint.link is not None and not constraint.editable:
|
||||
if constraint.link is not None and not constraint.editable and not (constraint.is_wheel or constraint.is_artifact):
|
||||
msg = ('pip-compile does not support URLs as packages, unless they are editable. '
|
||||
'Perhaps add -e option?')
|
||||
raise UnsupportedConstraint(msg, constraint)
|
||||
|
||||
+4
-1
@@ -128,7 +128,10 @@ class Project(object):
|
||||
):
|
||||
# If they are editable, do resolve them
|
||||
if 'editable' not in v:
|
||||
continue
|
||||
# allow wheels to be passed through
|
||||
if not (hasattr(v, 'keys') and v.get('path', v.get('file', '')).endswith('.whl')):
|
||||
continue
|
||||
ps.update({k: v})
|
||||
|
||||
else:
|
||||
ps.update({k: v})
|
||||
|
||||
+8
-3
@@ -66,7 +66,7 @@ requests = requests.Session()
|
||||
|
||||
|
||||
def get_requirement(dep):
|
||||
from pip9.req.req_install import _strip_extras
|
||||
from pip9.req.req_install import _strip_extras, Wheel
|
||||
import requirements
|
||||
"""Pre-clean requirement strings passed to the requirements parser.
|
||||
|
||||
@@ -137,6 +137,8 @@ def get_requirement(dep):
|
||||
elif req.local_file and path and not req.vcs:
|
||||
req.path = path
|
||||
req.uri = None
|
||||
if dep_link and dep_link.is_wheel and not req.name:
|
||||
req.name = os.path.basename(Wheel(dep_link.path).name)
|
||||
elif req.vcs and req.uri and cleaned_uri and cleaned_uri != uri:
|
||||
req.uri = strip_ssh_from_git_uri(req.uri)
|
||||
req.line = strip_ssh_from_git_uri(req.line)
|
||||
@@ -535,11 +537,14 @@ def convert_deps_from_pip(dep):
|
||||
# File installs.
|
||||
if (req.uri or req.path or is_installable_file(req.name)) and not req.vcs:
|
||||
# Assign a package name to the file, last 7 of it's sha256 hex digest.
|
||||
|
||||
if not req.uri and not req.path:
|
||||
req.path = os.path.abspath(req.name)
|
||||
|
||||
hashable_path = req.uri if req.uri else req.path
|
||||
req.name = hashlib.sha256(hashable_path.encode('utf-8')).hexdigest()
|
||||
req.name = req.name[len(req.name) - 7:]
|
||||
if not req.name:
|
||||
req.name = hashlib.sha256(hashable_path.encode('utf-8')).hexdigest()
|
||||
req.name = req.name[len(req.name) - 7:]
|
||||
# {path: uri} TOML (spec 4 I guess...)
|
||||
if req.uri:
|
||||
dependency[req.name] = {'file': hashable_path}
|
||||
|
||||
Reference in New Issue
Block a user