Skip to content

Commit 36adef9

Browse files
[bugfix] Update version configurations (backport #5771) (#5779)
Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk>
1 parent bce66a9 commit 36adef9

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ abqpy = "abqpy.__main__:main"
9393
where = ["src"]
9494

9595
[tool.setuptools_scm]
96-
version_scheme = "guess-next-dev"
9796
write_to = "src/abqpy/_version.py"
98-
fallback_version = "2016.0.0-dev"
9997

10098
[tool.pytest.ini_options]
10199
testpaths = ["src", "tests"]

src/abqpy/__init__.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
from pathlib import Path
4+
from re import error as RegexError
45

56
from .cli import AbqpyCLI, abaqus
67
from .run import run
@@ -12,23 +13,15 @@
1213

1314

1415
def _get_version():
15-
"""Return the version string used for __version__."""
16-
# Only shell out to a git subprocess if really needed, and not on a
17-
# shallow clone, such as those used by CI, as the latter would trigger
18-
# a warning from setuptools_scm.
1916
root = Path(__file__).resolve().parents[2]
2017
if (root / ".git").exists() and not (root / ".git/shallow").exists():
2118
try:
2219
import setuptools_scm
2320

24-
return setuptools_scm.get_version(
25-
root=str(root),
26-
version_scheme="guess-next-dev",
27-
fallback_version=_default_version,
28-
)
29-
except Exception:
21+
return setuptools_scm.get_version(root=str(root))
22+
except (ImportError, RegexError, LookupError):
3023
return _default_version
31-
else: # Get the version from the _version.py setuptools_scm file.
24+
else:
3225
return _default_version
3326

3427

@@ -39,4 +32,6 @@ def _get_version():
3932
"run",
4033
"abaqus",
4134
"AbqpyCLI",
35+
"__version__",
36+
"__semver__",
4237
]

0 commit comments

Comments
 (0)