nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: scikit-build/scikit-build-core
Pull request #887 (2024-09-03 12:49:14)

fix: use correct settings key to remove parts of the version in regex metadata plugin
Hello together.

I've been trying to use the `remove` settings key for the `regex` metadata plugin and noticed, that it has been non-functional for me. To me, it looks like the plugin acquires the wrong value from the settings dictionary (`result` instead of `remove`). This PR intends to change this to what I believe is correct.

LecrisUT: Looks correct. Funny thing is that this part is tested and passes somehow :sweat_smile:
https://github.com/scikit-build/scikit-build-core/blob/26526bd6b98ade3468de72933acc8398b21e7156/tests/test_dynamic_metadata.py#L344-L349
henryiii: Good point, fixed the test. 🤦 

Patch:
diff --git a/src/scikit_build_core/metadata/regex.py b/src/scikit_build_core/metadata/regex.py
index fdaf118..5f1213a 100644
--- a/src/scikit_build_core/metadata/regex.py
+++ b/src/scikit_build_core/metadata/regex.py
@@ -46,7 +46,7 @@ def dynamic_metadata(
     )
     result = settings.get("result", "{value}")
     assert isinstance(result, str)
-    remove = settings.get("result", "")
+    remove = settings.get("remove", "")
 
     with Path(input_filename).open(encoding="utf-8") as f:
         match = re.search(regex, f.read(), re.MULTILINE)


Test patch:
diff --git a/tests/test_dynamic_metadata.py b/tests/test_dynamic_metadata.py
index 129b429..d96d913 100644
--- a/tests/test_dynamic_metadata.py
+++ b/tests/test_dynamic_metadata.py
@@ -346,4 +346,4 @@ def test_regex_remove(
         },
     )
 
-    assert version == "1.2.3dev1" if dev else "1.2.3"
+    assert version == ("1.2.3dev1" if dev else "1.2.3")
Repository: scikit-build/scikit-build-core
Pull request #362 (2023-06-09 16:37:12)

fix: follow symlinks when making SDists
Fixing #359.

Needs a test.



Patch:
diff --git a/src/scikit_build_core/build/_file_processor.py b/src/scikit_build_core/build/_file_processor.py
index d0d462f..0e76832 100644
--- a/src/scikit_build_core/build/_file_processor.py
+++ b/src/scikit_build_core/build/_file_processor.py
@@ -41,7 +41,7 @@ def each_unignored_file(
     exclude_spec = pathspec.GitIgnoreSpec.from_lines(exclude_lines)
     include_spec = pathspec.GitIgnoreSpec.from_lines(include)
 
-    for dirpath, _, filenames in os.walk(str(starting_path)):
+    for dirpath, _, filenames in os.walk(str(starting_path), followlinks=True):
         all_paths = (Path(dirpath) / fn for fn in filenames)
         paths = (
             p


Test patch:
diff --git a/tests/test_file_processor.py b/tests/test_file_processor.py
new file mode 100644
index 0000000..7ec1d34
--- /dev/null
+++ b/tests/test_file_processor.py
@@ -0,0 +1,53 @@
+from __future__ import annotations
+
+import sys
+from pathlib import Path
+
+import pytest
+
+from scikit_build_core.build._file_processor import each_unignored_file
+
+
+@pytest.mark.skipif(
+    sys.version_info < (3, 8) and sys.platform.startswith("win"),
+    reason="Python 3.8+ required for symlinks on Windows",
+)
+@pytest.mark.skipif(
+    sys.implementation.name == "pypy" and sys.platform.startswith("win"),
+    reason="PyPy on Windows does not support symlinks",
+)
+def test_on_each_with_symlink(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
+    """
+    Test that each_unignored_file() does not follow symlinks.
+    """
+    monkeypatch.chdir(tmp_path)
+    # Set up a gitignore
+    gitignore = Path(".gitignore")
+    gitignore.write_text("/hidden_dir")
+    # Create a directory with a symlink to a file in the same directory
+    dir = Path("dir")
+    dir.mkdir()
+    file1 = dir / "file"
+    file1.write_text("content")
+    file2 = dir / "link"
+    file2.symlink_to("file")
+    hidden_dir = Path("hidden_dir")
+    hidden_dir.mkdir()
+    hidden_file = hidden_dir / "file2"
+    hidden_file.write_text("content2")
+    exposed_symlink = dir / "exposed_symlink"
+    exposed_symlink.symlink_to("../hidden_dir")
+
+    if (
+        sys.platform.startswith("win")
+        and not exposed_symlink.joinpath("file2").is_file()
+    ):
+        pytest.skip("Windows symlink support not available")
+
+    # Test that each_unignored_file() follows the symlink
+    assert sorted(each_unignored_file(Path("."))) == [
+        gitignore,
+        exposed_symlink / "file2",
+        file1,
+        file2,
+    ]