diff --git a/news/6017.bugfix.rst b/news/6017.bugfix.rst new file mode 100644 index 0000000000..b13de4078a --- /dev/null +++ b/news/6017.bugfix.rst @@ -0,0 +1 @@ +Fix regression with path installs on most recent release ``2023.11.14`` diff --git a/pipenv/utils/dependencies.py b/pipenv/utils/dependencies.py index 05cc9cbf9f..10cae818b0 100644 --- a/pipenv/utils/dependencies.py +++ b/pipenv/utils/dependencies.py @@ -667,11 +667,11 @@ def ensure_path_is_relative(file_path): # Check if the paths are on different drives if abs_path.drive != current_dir.drive: # If on different drives, return the absolute path - return abs_path + return str(abs_path) try: # Try to create a relative path - return abs_path.relative_to(current_dir) + return str(abs_path.relative_to(current_dir)) except ValueError: # If the direct relative_to fails, manually compute the relative path common_parts = 0 diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index 4bb250180f..4979a06ef9 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -7,6 +7,35 @@ from pipenv.utils.shell import temp_environ +@pytest.mark.extras +@pytest.mark.install +@pytest.mark.local +def test_local_path_issue_6016(pipenv_instance_pypi): + with pipenv_instance_pypi() as p: + setup_py = os.path.join(p.path, "setup.py") + with open(setup_py, "w") as fh: + contents = """ +from setuptools import setup, find_packages +setup( + name='testpipenv', + version='0.1', + description='Pipenv Test Package', + author='Pipenv Test', + author_email='test@pipenv.package', + license='MIT', + packages=find_packages(), + install_requires=[], + extras_require={'dev': ['six']}, + zip_safe=False +) + """.strip() + fh.write(contents) + # project.write_toml({"packages": pipfile, "dev-packages": {}}) + c = p.pipenv("install .") + assert c.returncode == 0 + assert "testpipenv" in p.lockfile["default"] + + @pytest.mark.extras @pytest.mark.install @pytest.mark.local