-
Notifications
You must be signed in to change notification settings - Fork 85
feat(sdist): resolve symlinks by default #1265
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
Open
Doekin
wants to merge
6
commits into
scikit-build:main
Choose a base branch
from
Doekin:fix-sdist-symlinks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dbc78d4
fix(sdist): dereference symlinks by default
184cd41
test(sdist): add tests for symlink dereferencing
821059e
build(schema): regenerate schemas for new sdist.dereference setting
50c81e8
refactor(sdist): rename dereference to resolve_symlinks, refactor tests
Doekin ffb3892
feat: add sdist.resolve-symlinks option, default true (backcompat for…
Doekin e248401
fix(tests): adjust symlink checks in can_symlink fixture and update a…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import tarfile | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| from scikit_build_core.build import build_sdist | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def can_symlink(tmp_path: Path) -> None: | ||
| """Skip the test if symlinks are not supported on this OS.""" | ||
| target = tmp_path / "target" | ||
| target.touch() | ||
| try: | ||
| tmp_path.joinpath("link").symlink_to(target) | ||
| except OSError: | ||
| pytest.skip( | ||
| "Creating symlinks is not supported/allowed on this OS without privileges" | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.usefixtures("package_simple_pyproject_ext", "can_symlink") | ||
| @pytest.mark.parametrize( | ||
| ("config_settings", "expected_type"), | ||
| [ | ||
| pytest.param({}, "reg", id="dereference_default"), | ||
| pytest.param({"sdist.resolve-symlinks": "false"}, "sym", id="no_dereference"), | ||
| ], | ||
| ) | ||
| def test_pep517_sdist_symlink( | ||
| tmp_path: Path, | ||
| config_settings: dict[str, list[str] | str], | ||
| expected_type: str, | ||
| ) -> None: | ||
| Path("CMakeLists_link.txt").symlink_to("CMakeLists.txt") | ||
|
|
||
| out = build_sdist(str(tmp_path), config_settings=config_settings or None) | ||
|
|
||
| with tarfile.open(tmp_path / out, "r:gz") as tar: | ||
| link_member = tar.getmember("cmake_example-0.0.1/CMakeLists_link.txt") | ||
| if expected_type == "reg": | ||
| assert link_member.isreg(), ( | ||
| "The symlink should have been stored as a regular file" | ||
| ) | ||
| else: | ||
| assert link_member.issym(), ( | ||
| "The symlink should have been stored as a symlink" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.