Skip to content

Commit 85ba107

Browse files
authored
Treat all return paths of this method as strings (#6017)
* Treat all return paths of this method as strings (with test)
1 parent acbcdcc commit 85ba107

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

news/6017.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix regression with path installs on most recent release ``2023.11.14``

pipenv/utils/dependencies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,11 +667,11 @@ def ensure_path_is_relative(file_path):
667667
# Check if the paths are on different drives
668668
if abs_path.drive != current_dir.drive:
669669
# If on different drives, return the absolute path
670-
return abs_path
670+
return str(abs_path)
671671

672672
try:
673673
# Try to create a relative path
674-
return abs_path.relative_to(current_dir)
674+
return str(abs_path.relative_to(current_dir))
675675
except ValueError:
676676
# If the direct relative_to fails, manually compute the relative path
677677
common_parts = 0

tests/integration/test_install_twists.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@
77
from pipenv.utils.shell import temp_environ
88

99

10+
@pytest.mark.extras
11+
@pytest.mark.install
12+
@pytest.mark.local
13+
def test_local_path_issue_6016(pipenv_instance_pypi):
14+
with pipenv_instance_pypi() as p:
15+
setup_py = os.path.join(p.path, "setup.py")
16+
with open(setup_py, "w") as fh:
17+
contents = """
18+
from setuptools import setup, find_packages
19+
setup(
20+
name='testpipenv',
21+
version='0.1',
22+
description='Pipenv Test Package',
23+
author='Pipenv Test',
24+
author_email='test@pipenv.package',
25+
license='MIT',
26+
packages=find_packages(),
27+
install_requires=[],
28+
extras_require={'dev': ['six']},
29+
zip_safe=False
30+
)
31+
""".strip()
32+
fh.write(contents)
33+
# project.write_toml({"packages": pipfile, "dev-packages": {}})
34+
c = p.pipenv("install .")
35+
assert c.returncode == 0
36+
assert "testpipenv" in p.lockfile["default"]
37+
38+
1039
@pytest.mark.extras
1140
@pytest.mark.install
1241
@pytest.mark.local

0 commit comments

Comments
 (0)