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

Treat all return paths of this method as strings #6017

Merged
merged 3 commits into from
Nov 15, 2023
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/6017.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix regression with path installs on most recent release ``2023.11.14``
4 changes: 2 additions & 2 deletions pipenv/utils/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions tests/integration/test_install_twists.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down