Replace the three instances of version information with a VERSION file
in the hawkmoth package, and read the version from there where needed.
Add the VERSION to package_data.
---
doc/conf.py | 11 +++++------
hawkmoth/VERSION | 1 +
hawkmoth/__init__.py | 6 ++++--
setup.py | 15 +++++++++++----
4 files changed, 21 insertions(+), 12 deletions(-)
create mode 100644 hawkmoth/VERSION
diff --git a/doc/conf.py b/doc/conf.py
index 5ce3e9621ab1..97f45ec1b6bc 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -23,14 +23,13 @@ extensions = [
# -- Project information -----------------------------------------------------
project = 'Hawkmoth'
-copyright = '2017, Jani Nikula'
+copyright = '2017-2019, Jani Nikula'
author = 'Jani Nikula'
-# The short X.Y version
-version = '0.2'
-# The full version, including alpha/beta/rc tags
-release = version
-
+with open(os.path.join(os.path.abspath(os.path.dirname(__file__)),
+ '../hawkmoth/VERSION')) as version_file:
+ version = version_file.read().strip()
+ release = version
# -- General configuration ---------------------------------------------------
diff --git a/hawkmoth/VERSION b/hawkmoth/VERSION
new file mode 100644
index 000000000000..3b04cfb60da1
--- /dev/null
+++ b/hawkmoth/VERSION
@@ -0,0 +1 @@
+0.2
diff --git a/hawkmoth/__init__.py b/hawkmoth/__init__.py
index c55a42173bc1..c050d1ffc1fa 100644
--- a/hawkmoth/__init__.py
+++ b/hawkmoth/__init__.py
@@ -7,8 +7,6 @@ Hawkmoth
Sphinx C Domain autodoc directive extension.
"""
-__version__ = '0.2'
-
import glob
import os
import re
@@ -26,6 +24,10 @@ from sphinx.util.docutils import switch_source_input
# The parser bits
from . import hawkmoth
+with open(os.path.join(os.path.abspath(os.path.dirname(__file__)),
+ 'VERSION')) as version_file:
+ __version__ = version_file.read().strip()
+
class CAutoDocDirective(Directive):
"""Extract all documentation comments from the specified file"""
required_argument = 1
diff --git a/setup.py b/setup.py
index ccacc15f6c04..47fdab41123a 100644
--- a/setup.py
+++ b/setup.py
@@ -4,13 +4,17 @@
import os
import setuptools
-readme = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.rst')
-with open(readme, 'r') as file:
- long_description = file.read()
+with open(os.path.join(os.path.abspath(os.path.dirname(__file__)),
+ 'hawkmoth/VERSION')) as version_file:
+ version = version_file.read().strip()
+
+with open(os.path.join(os.path.abspath(os.path.dirname(__file__)),
+ 'README.rst')) as readme_file:
+ long_description = readme_file.read()
setuptools.setup(
name = 'hawkmoth',
- version = '0.2',
+ version = version,
author = 'Jani Nikula',
author_email = 'jani@xxxxxxxxxx',
license = '2-Clause BSD',
@@ -22,6 +26,9 @@ setuptools.setup(
'hawkmoth',
'hawkmoth.*',
]),
+ package_data = {
+ 'hawkmoth': ['VERSION'],
+ },
install_requires = [
'sphinx',
# 'clang', # depend on distro packaging
--
2.20.1