Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nested vcs dependency subdirectory when locking to Pipfile.lock (Fix #6120) #6136

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/6136.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that vcs subdependencies were locked without their subdirectory fragment if they had one
10 changes: 9 additions & 1 deletion pipenv/utils/locking.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
clean_resolved_dep,
determine_vcs_revision_hash,
expansive_install_req_from_line,
normalize_vcs_url,
pep423_name,
translate_markers,
)
Expand Down Expand Up @@ -61,9 +62,16 @@ def format_requirement_for_lockfile(
if req.link and req.link.is_vcs:
vcs = req.link.scheme.split("+", 1)[0]
entry["ref"] = determine_vcs_revision_hash(req, vcs, pipfile_entry.get("ref"))
entry[vcs] = original_deps.get(name, req.link.url)

if name in original_deps:
entry[vcs] = original_deps[name]
else:
vcs_url, _ = normalize_vcs_url(req.link.url)
entry[vcs] = vcs_url
if pipfile_entry.get("subdirectory"):
entry["subdirectory"] = pipfile_entry["subdirectory"]
elif req.link.subdirectory_fragment:
entry["subdirectory"] = req.link.subdirectory_fragment
if req.req:
entry["version"] = str(req.specifier)
elif version:
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ def test_lock_nested_vcs_direct_url(pipenv_instance_pypi):
assert "git" in p.lockfile["default"]["pep508-package"]
assert "sibling-package" in p.lockfile["default"]
assert "git" in p.lockfile["default"]["sibling-package"]
assert "subdirectory" in p.lockfile["default"]["sibling-package"]["git"]
assert "subdirectory" in p.lockfile["default"]["sibling-package"]
assert p.lockfile["default"]["sibling-package"]["subdirectory"] == "parent_folder/sibling_package"
assert "version" not in p.lockfile["default"]["sibling-package"]


Expand Down
Loading