From dbf5919badd2e88dc49cf40ebb3083c2381e3626 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 15 Nov 2023 17:56:48 -0500 Subject: [PATCH 1/3] Treat all return paths of this method as strings --- pipenv/utils/dependencies.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipenv/utils/dependencies.py b/pipenv/utils/dependencies.py index 05cc9cbf9..10cae818b 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 From 1fc4b3237bfdc3f7a4edd8eb47879837994d0f2a Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 15 Nov 2023 18:05:31 -0500 Subject: [PATCH 2/3] Add some TDD --- tests/integration/test_install_twists.py | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index 4bb250180..4979a06ef 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 From 616da99081993acf038468e25ccc7af6a76c1dd3 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 15 Nov 2023 18:07:25 -0500 Subject: [PATCH 3/3] add news fragment --- news/6017.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/6017.bugfix.rst diff --git a/news/6017.bugfix.rst b/news/6017.bugfix.rst new file mode 100644 index 000000000..b13de4078 --- /dev/null +++ b/news/6017.bugfix.rst @@ -0,0 +1 @@ +Fix regression with path installs on most recent release ``2023.11.14``