summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorChandan Singh <chandan@chandansingh.net>2020-11-09 23:49:30 +0000
committerJürg Billeter <j@bitron.ch>2020-11-24 09:51:03 +0000
commit51fbd66a0e9f0d575fcda8003c3828ffc2484788 (patch)
treeb91ba944cc0649e8009f60460fb8afcf81dab7b4 /setup.py
parent8c0c1f960d8bd2c4495e11163eea3d7c5d000bb1 (diff)
downloadbuildstream-51fbd66a0e9f0d575fcda8003c3828ffc2484788.tar.gz
setup.py: Ensure we have a version numberchandan/setup-py-version-warn
BuildStream requires a version number at runtime. But, builds fine if I can't find any tags. So, make it an error at build time if we don't have a valid version number. Fixes #1383.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 334a96e2a..a7c698030 100755
--- a/setup.py
+++ b/setup.py
@@ -24,10 +24,24 @@ from pathlib import Path
import re
import sys
+
+###################################
+# Ensure we have a version number #
+###################################
+
# Add local directory to the path, in order to be able to import versioneer
sys.path.append(os.path.dirname(__file__))
import versioneer # pylint: disable=wrong-import-position
+version = versioneer.get_version()
+
+if version.startswith("0+untagged"):
+ print(
+ "Your git repository has no tags - BuildStream can't " "determine its version. Please run `git fetch --tags`.",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
##################################################################
# Python requirements
@@ -315,8 +329,7 @@ register_cython_module("buildstream._variables", dependencies=["buildstream.node
#####################################################
setup(
name="BuildStream",
- # Use versioneer
- version=versioneer.get_version(),
+ version=version,
cmdclass=get_cmdclass(),
author="BuildStream Developers",
author_email="dev@buildstream.apache.org",