-
Notifications
You must be signed in to change notification settings - Fork 85
feat(sdist): dereference 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
base: main
Are you sure you want to change the base?
Changes from all commits
dbc78d4
184cd41
821059e
50c81e8
ffb3892
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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() -> None: | ||||||||||||||||||||||||||||||||||||||||||||||
| """Skip the test if symlinks are not supported on this OS.""" | ||||||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||||||
| Path("_symlink_check").symlink_to("_symlink_check_target") | ||||||||||||||||||||||||||||||||||||||||||||||
| except OSError: | ||||||||||||||||||||||||||||||||||||||||||||||
| pytest.skip( | ||||||||||||||||||||||||||||||||||||||||||||||
| "Creating symlinks is not supported/allowed on this OS without privileges" | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||
| Path("_symlink_check").unlink(missing_ok=True) | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+21
|
||||||||||||||||||||||||||||||||||||||||||||||
| def can_symlink() -> None: | |
| """Skip the test if symlinks are not supported on this OS.""" | |
| try: | |
| Path("_symlink_check").symlink_to("_symlink_check_target") | |
| except OSError: | |
| pytest.skip( | |
| "Creating symlinks is not supported/allowed on this OS without privileges" | |
| ) | |
| else: | |
| Path("_symlink_check").unlink(missing_ok=True) | |
| def can_symlink(tmp_path_factory) -> None: | |
| """Skip the test if symlinks are not supported on this OS.""" | |
| check_dir = tmp_path_factory.mktemp("symlink_check") | |
| check_link = check_dir / "_symlink_check" | |
| try: | |
| check_link.symlink_to("_symlink_check_target") | |
| except OSError: | |
| pytest.skip( | |
| "Creating symlinks is not supported/allowed on this OS without privileges" | |
| ) | |
| else: | |
| check_link.unlink(missing_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this also could be cached, vs. being computed each time.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -43,6 +43,7 @@ def test_skbuild_settings_default(tmp_path: Path): | |||||
| assert settings.sdist.inclusion_mode == "default" | ||||||
| assert settings.sdist.reproducible | ||||||
| assert not settings.sdist.cmake | ||||||
| assert settings.sdist.resolve_symlinks | ||||||
|
henryiii marked this conversation as resolved.
|
||||||
| assert settings.wheel.packages is None | ||||||
| assert settings.wheel.py_api == "" | ||||||
| assert not settings.wheel.expand_macos_universal_tags | ||||||
|
|
@@ -947,3 +948,37 @@ def test_backcompat_sdist_inclusion_mode( | |||||
|
|
||||||
| settings_reader = SettingsReader.from_file(pyproject_toml, {}) | ||||||
| assert settings_reader.settings.sdist.inclusion_mode == "classic" | ||||||
|
|
||||||
|
|
||||||
| def test_backcompat_sdist_resolve_symlinks( | ||||||
| tmp_path: Path, monkeypatch: pytest.MonkeyPatch | ||||||
| ): | ||||||
| monkeypatch.setattr( | ||||||
| scikit_build_core.settings.skbuild_read_settings, "__version__", "0.13.0" | ||||||
| ) | ||||||
| pyproject_toml = tmp_path / "pyproject.toml" | ||||||
| pyproject_toml.write_text( | ||||||
| textwrap.dedent( | ||||||
| """\ | ||||||
| [tool.scikit-build] | ||||||
| minimum-version = "0.12" | ||||||
| """ | ||||||
| ), | ||||||
| encoding="utf-8", | ||||||
| ) | ||||||
|
|
||||||
| settings_reader = SettingsReader.from_file(pyproject_toml, {}) | ||||||
| assert not settings_reader.settings.sdist.resolve_symlinks | ||||||
|
||||||
| assert not settings_reader.settings.sdist.resolve_symlinks | |
| assert settings_reader.settings.sdist.resolve_symlinks is False |
Uh oh!
There was an error while loading. Please reload this page.