From 596f1dcaa14866b509c5e3ae5a04267eb198b065 Mon Sep 17 00:00:00 2001 From: "Manoel V. Machado" Date: Mon, 27 May 2024 21:27:34 -0300 Subject: [PATCH] fix: Treat PDM_BUILD_SCM_VERSION empty string as unset (#238) Doesn't makes sense to have a empty version, make easier to treat PDM_BUILD_SCM_VERSION as empty string when you don't have tag information, and instead, use fallback_version. --- src/pdm/backend/hooks/version/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdm/backend/hooks/version/__init__.py b/src/pdm/backend/hooks/version/__init__.py index df0a667..a94cbbc 100644 --- a/src/pdm/backend/hooks/version/__init__.py +++ b/src/pdm/backend/hooks/version/__init__.py @@ -79,7 +79,7 @@ def resolve_version_from_scm( version_format: str | None = None, fallback_version: str | None = None, ) -> str: - if "PDM_BUILD_SCM_VERSION" in os.environ: + if os.environ.get("PDM_BUILD_SCM_VERSION"): version = os.environ["PDM_BUILD_SCM_VERSION"] else: if version_format is not None: