Skip to content

Commit 01660ba

Browse files
Merge pull request #1168 from RonnyPfannschmidt/fix-873-no-version-means-no-infer
dont infer version in cli if --no-version is given
2 parents 7e86a9b + 5350378 commit 01660ba

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
- fix #501: add py.typed
4141
- fix #804: git - use fallback version instead of 0.0 when no version is found at all
4242
- fix #1139: use logging.lastResort instead of a own replica to avoid polluting logging._handlerList
43+
- fix #873: don't infer version in cli if --no-version is given
4344

4445
## v8.3.1
4546

src/setuptools_scm/_cli.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ def main(args: list[str] | None = None) -> int:
3333
file=sys.stderr,
3434
)
3535
config = Configuration(root=inferred_root)
36-
37-
version = _get_version(
38-
config, force_write_version_files=opts.force_write_version_files
39-
)
36+
version: str | None
37+
if opts.no_version:
38+
version = "0.0.0+no-version-was-requested.fake-version"
39+
else:
40+
version = _get_version(
41+
config, force_write_version_files=opts.force_write_version_files
42+
)
4043
if version is None:
4144
raise SystemExit("ERROR: no version found for", opts)
4245
if opts.strip_dev:

0 commit comments

Comments
 (0)