Skip to content

Commit 5c7025d

Browse files
committed
lock: use canonical base dir to compute relavite directories
To avoid symlink issues.
1 parent 8fb8996 commit 5c7025d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/pip/_internal/commands/lock.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def run(self, options: Values, args: List[str]) -> int:
159159
"%s is not a valid lock file name.",
160160
output_file_path,
161161
)
162-
base_dir = output_file_path.parent.absolute()
162+
base_dir = output_file_path.parent
163163
pylock_toml = Pylock.from_install_requirements(
164164
requirement_set.requirements.values(), base_dir=base_dir
165165
).as_toml()

src/pip/_internal/models/pylock.py

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class Package:
8888

8989
@classmethod
9090
def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> Self:
91+
base_dir = base_dir.resolve()
9192
dist = ireq.get_dist()
9293
download_info = ireq.download_info
9394
assert download_info
@@ -105,6 +106,7 @@ def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> S
105106
package.directory = PackageDirectory(
106107
path=(
107108
Path(url_to_path(download_info.url))
109+
.resolve()
108110
.relative_to(base_dir)
109111
.as_posix()
110112
),

0 commit comments

Comments
 (0)