diff --git a/CHANGELOG.md b/CHANGELOG.md index ea5b652f..ca407920 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ - fix #501: add py.typed - fix #804: git - use fallback version instead of 0.0 when no version is found at all - fix #1139: use logging.lastResort instead of a own replica to avoid polluting logging._handlerList +- fix #873: don't infer version in cli if --no-version is given ## v8.3.1 diff --git a/src/setuptools_scm/_cli.py b/src/setuptools_scm/_cli.py index b54903a4..3f33f83d 100644 --- a/src/setuptools_scm/_cli.py +++ b/src/setuptools_scm/_cli.py @@ -33,10 +33,13 @@ def main(args: list[str] | None = None) -> int: file=sys.stderr, ) config = Configuration(root=inferred_root) - - version = _get_version( - config, force_write_version_files=opts.force_write_version_files - ) + version: str | None + if opts.no_version: + version = "0.0.0+no-version-was-requested.fake-version" + else: + version = _get_version( + config, force_write_version_files=opts.force_write_version_files + ) if version is None: raise SystemExit("ERROR: no version found for", opts) if opts.strip_dev: