diff --git a/pyproject.toml b/pyproject.toml index 13885dde6f0c2fe7af3d0fadd5503378a43f54c9..f996241e82b32320f68856b7aebc7180a9ae82a8 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 8ef362c4dd3b08c4bfedea83430a86cf6ca51a8e..ddf940b88a3039a6d7405ce4cc74523c52bf72c9 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(