Skip to content

Commit

Permalink
fix: use correct settings key to remove parts of the version in regex…
Browse files Browse the repository at this point in the history
… metadata plugin (#887)

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.

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
  • Loading branch information
philippjh and henryiii authored Sep 3, 2024
1 parent 26526bd commit 9f54443
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/scikit_build_core/metadata/regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dynamic_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 9f54443

Please sign in to comment.