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

In PEP 660 mode, the pth must point to an absolute directory #449

Merged
merged 1 commit into from Oct 2, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion flit_core/flit_core/wheel.py
Expand Up @@ -148,7 +148,7 @@ def copy_module(self):

def add_pth(self):
with self._write_to_zip(self.module.name + ".pth") as f:
f.write(str(self.module.source_dir))
f.write(str(self.module.source_dir.resolve()))

def write_metadata(self):
log.info('Writing metadata files')
Expand Down
17 changes: 17 additions & 0 deletions tests/test_wheel.py
Expand Up @@ -36,6 +36,23 @@ def test_editable_wheel_module(copy_sample):
assert pth_path.read_text() == str(td)
assert_isdir(Path(unpacked, 'module1-0.1.dist-info'))

def test_editable_wheel_has_absolute_pth(copy_sample):
td = copy_sample('module1_toml')
oldcwd = os.getcwd()
os.chdir(str(td))
try:
make_wheel_in(Path('pyproject.toml'), Path('.'), editable=True)
whl_file = 'module1-0.1-py2.py3-none-any.whl'
assert_isfile(whl_file)
with unpack(whl_file) as unpacked:
pth_path = Path(unpacked, 'module1.pth')
assert_isfile(pth_path)
assert Path(pth_path.read_text()).is_absolute()
assert pth_path.read_text() == str(td.resolve())
assert_isdir(Path(unpacked, 'module1-0.1.dist-info'))
finally:
os.chdir(oldcwd)

def test_wheel_package(copy_sample):
td = copy_sample('package1')
make_wheel_in(td / 'pyproject.toml', td)
Expand Down