Skip to content

Commit 4937adc

Browse files
authored
CM-25271 - Improve version managing of pre-commit hook (#144)
Fix shallow repository
1 parent 4b7bc8c commit 4937adc

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

cycode/__init__.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1 @@
11
__version__ = '0.0.0' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
2-
3-
if __version__ == '0.0.1.dev1':
4-
# If CLI was installed from shallow clone, __version__ will be 0.0.1.dev1 due to non-strict versioning.
5-
# This happens when installing CLI as pre-commit hook.
6-
# We are not able to provide the version based on Git Tag in this case.
7-
# This fallback version is maintained manually.
8-
9-
# One benefit of it is that we could pass the version with a special suffix to mark pre-commit hook usage.
10-
11-
import os
12-
13-
version_filepath = os.path.join(os.path.dirname(__file__), 'pre-commit-hook-version')
14-
with open(version_filepath, 'r', encoding='UTF-8') as f:
15-
__version__ = f.read().strip()

cycode/pre-commit-hook-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ log_cli = true
5959
[tool.poetry-dynamic-versioning]
6060
# poetry self add "poetry-dynamic-versioning[plugin]"
6161
enable = true
62-
strict = false
62+
strict = true
6363
bump = true
6464
metadata = false
65+
fix-shallow-repository=true
6566
vcs = "git"
6667
style = "pep440"
6768

@@ -134,5 +135,5 @@ inline-quotes = "single"
134135
"cycode/*.py" = ["BLE001"]
135136

136137
[build-system]
137-
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
138+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=0.25.0"]
138139
build-backend = "poetry_dynamic_versioning.backend"

0 commit comments

Comments
 (0)