Skip to content

Commit

Permalink
Force version path rather than relying on autodetect
Browse files Browse the repository at this point in the history
This repo has several files containing `__version__`, seeing as there's
a few sample projects under `tests/` directory. Better explicitly set
the path to the file we want to manage.
  • Loading branch information
rohanpm committed Oct 3, 2024
1 parent f797e2c commit b48a448
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ dependencies = { file = "requirements.in" }
[tool.isort]
profile = "black"

[tool.buildsys-dateversion]
version-path = "src/buildsys_dateversion/__init__.py"

[build-system]
requires = []
backend-path = ["src"]
Expand Down
4 changes: 4 additions & 0 deletions src/buildsys_dateversion/_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def _find_version_path(self) -> str:
if not file.endswith(".py"):
continue

# TODO: revisit handling of multiple matches:
# - assume shortest path is the best?
# - give fatal error?
# - update all of them?
path = os.path.join(dirpath, file)
LOG.debug("Checking file %s", path)
if VERSION_PATTERN.search(open(path).read()):
Expand Down

0 comments on commit b48a448

Please sign in to comment.