You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/08/23 13:48:15 UTC

[buildstream-plugins] 01/01: Encode hard coded version in one location instead of two

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/encode-docs-version
in repository https://gitbox.apache.org/repos/asf/buildstream-plugins.git

commit 2451b9a937ccf64d3469a8880279987c172c60b9
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Tue Aug 23 22:45:46 2022 +0900

    Encode hard coded version in one location instead of two
    
    This could be improved to go full fledged versioneer like BuildStream, but
    for now instead of hard coding the version in setup.py and doc/source/conf.py,
    just encode it in the toplevel __init__.py and derive it from both locations.
    
     * src/buildstream_plugins/__init__.py: Set __version__ here
    
     * setup.py: Import __version__ and use it for invoking setuptools
    
     * doc/source/conf.py: Import __version__ and use it to set the docs version
---
 doc/source/conf.py                  | 6 ++++--
 setup.py                            | 8 +++++++-
 src/buildstream_plugins/__init__.py | 4 ++++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/doc/source/conf.py b/doc/source/conf.py
index 1c0a614..563fed7 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -19,6 +19,8 @@
 #
 import os
 import sys
+from buildstream_plugins import __version__
+
 sys.path.insert(0, os.path.abspath('..'))
 
 # -- General configuration ------------------------------------------------
@@ -62,9 +64,9 @@ author = 'BuildStream Developers'
 # built documents.
 #
 # The short X.Y version.
-version = '1.91'
+version = __version__
 # The full version, including alpha/beta/rc tags.
-release = '1.91.0'
+release = __version__
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/setup.py b/setup.py
index c1fcb66..f8ec8fe 100755
--- a/setup.py
+++ b/setup.py
@@ -37,10 +37,16 @@ with open(
 ) as readme:
     long_description = readme.read()
 
+###############################################################################
+#                             Load the version                                #
+###############################################################################
+
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))
+from buildstream_plugins import __version__
 
 setup(
     name="buildstream-plugins",
-    version="1.95.1",
+    version=__version__,
     author="BuildStream Developers",
     author_email="dev@buildstream.apache.org",
     classifiers=[
diff --git a/src/buildstream_plugins/__init__.py b/src/buildstream_plugins/__init__.py
index e69de29..e0d37ee 100644
--- a/src/buildstream_plugins/__init__.py
+++ b/src/buildstream_plugins/__init__.py
@@ -0,0 +1,4 @@
+#
+# Remember to adjust this version number before tagging releases
+#
+__version__ = "1.95.1"