From 2b6742549b9343e035441525de195e076f65a865 Mon Sep 17 00:00:00 2001
From: Bert Palm <bert.palm@ufz.de>
Date: Thu, 27 Jul 2023 14:22:53 +0200
Subject: [PATCH] changed versioneer style

---
 pyproject.toml |  2 +-
 setup.py       | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 13885dde6..f996241e8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,7 +12,7 @@ markers = "slow: marks tests as slow (deselect with '-m \"not slow\"')"
 
 [tool.versioneer]
 VCS = "git"
-style = "pep440"
+style = "pep440-post"
 versionfile_source = "saqc/_version.py"
 versionfile_build = "saqc/_version.py"
 tag_prefix = "v"
diff --git a/setup.py b/setup.py
index 8ef362c4d..ddf940b88 100644
--- a/setup.py
+++ b/setup.py
@@ -14,14 +14,20 @@ with open("README.md", "r") as fh:
 
 name = os.environ.get("PYPI_PKG_NAME", "saqc")
 if not name:
+    raise ValueError("Environment variable PYPI_PKG_NAME must not be an empty string.")
+
+versions = versioneer.get_versions()
+print(f"Building saqc: {versions}")
+if versions["dirty"]:
     raise ValueError(
-        "Environment variable PYPI_PKG_NAME must not be an empty string."
+        f"The repository you build is dirty. Please commit changes first {versions=}."
     )
-
-version = versioneer.get_version()
-if "dirty" in version:
+version = versions["version"]
+if "post" in version and name == "saqc":
     raise ValueError(
-        f"The repository you build is dirty. Please commit changes first. {version=}"
+        f"An saqc release must have version in the format X.Y.Z, "
+        f"which requires a git tag on the same commit. Please set "
+        f"a tag, then build again. {versions=}"
     )
 
 setup(
-- 
GitLab