Skip to content

Commit

Permalink
load version info from central ioc/VERSION file
Browse files Browse the repository at this point in the history
  • Loading branch information
gronke committed Jan 5, 2019
1 parent 12a23f4 commit d52d149
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
9 changes: 6 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# import sys
# sys.path.insert(0, '/usr/local/src/libioc/iocage')
import sphinx.apidoc
import os.path

def setup(app):
sphinx.ext.apidoc.main([
Expand All @@ -35,9 +36,11 @@ def setup(app):
author = 'ioc Contributors'

# The short X.Y version
version = '0.4.0'
# The full version, including alpha/beta/rc tags
release = ''
__dirname = os.path.dirname(__file__)
__version_file = os.path.join(__dirname, '../ioc/VERSION')
with open(__version_file, "r") as f:
release = f.read().split("\n")[0]
version = release.split()[0]


# -- General configuration ---------------------------------------------------
Expand Down
8 changes: 7 additions & 1 deletion ioc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@
# POSSIBILITY OF SUCH DAMAGE.
"""Libioc Python module ioc."""
import sys
import os.path
import importlib
import typing

VERSION = "0.4.0 2019/01/04"

def _get_version():
__dirname = os.path.dirname(__file__)
__version_file = os.path.join(__dirname, 'VERSION')
with open(__version_file, "r") as f:
return f.read().split("\n")[0]


class _HookedModule:
Expand Down
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,21 @@ def _read_requirements(
if sys.version_info < (3, 6):
exit("Only Python 3.6 and higher is supported.")

with open("ioc/VERSION", "r") as f:
version = f.read().split()[0]

setup(
name='ioc',
license='BSD',
version='0.4.0',
description='A Python library to manage jails with ioc (an iocage fork)',
version=version,
description='A Python library to manage jails with ioc{age,cell}',
keywords='FreeBSD jail ioc',
author='ioc Contributors',
author_email='authors@ioc.io',
url='https://github.com/bsdci/ioc',
url='https://github.com/bsdci/libioc',
python_requires='>=3.6',
packages=find_packages(include=["ioc", "ioc.*"]),
package_data={'': ['VERSION']},
include_package_data=True,
install_requires=ioc_requirements["install_requires"],
dependency_links=ioc_requirements["dependency_links"],
Expand Down

0 comments on commit d52d149

Please sign in to comment.