Skip to content

Commit

Permalink
Version from tag
Browse files Browse the repository at this point in the history
  • Loading branch information
SteinHeselmans committed Feb 10, 2019
1 parent 235cdd9 commit b4a7065
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ pip-selfcheck.json
# vim
*.swp


# Offline version file
src/duco/__ducobox_version__.py

# Project stuff
duco_network.ini
influxdb.ini
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Data can be logged to an influxDB server, by passing a configuration file to the

Format of this configuration file through an example:

.. code-block::
.. code-block:: ini
[InfluxDB]
url = localhost
Expand Down
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

import sys, os, subprocess

from pkg_resources import get_distribution
pkg_version = get_distribution('duco.ducobox').version

# Append src directory to path so that autodoc can find the python module
sys.path.append("src")

Expand Down Expand Up @@ -30,7 +33,7 @@
year = '2017'
author = 'Stein Heselmans'
copyright = '{0}, {1}'.format(year, author)
version = release = '0.1.0'
version = release = pkg_version

pygments_style = 'trac'
templates_path = ['.']
Expand Down
20 changes: 6 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
import io
from glob import glob
from os.path import basename, dirname, join, splitext
from os.path import basename, splitext

from setuptools import find_packages, setup

PROJECT_URL = 'https://github.com/SteinHeselmans/DucoBox'
__version__ = 'unknown'
exec(open('src/duco/__version__.py').read())


def read(*names, **kwargs):
return io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
).read()


requires = ['setuptools-scm', 'pyserial', 'influxdb']

setup(
name='duco.ducobox',
url=PROJECT_URL,
version=__version__,
setup_requires=[],
use_scm_version={
'write_to': 'src/duco/__ducobox_version__.py'
},
setup_requires=['setuptools_scm'],
author='Stein Heselmans',
author_email='[email protected]',
description='Read parameters from DucoBox.',
Expand Down Expand Up @@ -52,6 +43,7 @@ def read(*names, **kwargs):
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Home Automation',
],
keywords=['Duco', 'DucoBox', 'DucoBox Silent', 'ventilation', 'home automation'],
Expand Down
9 changes: 6 additions & 3 deletions src/duco/ducobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
from serial import Serial, SerialException
from influxdb import InfluxDBClient

# Get version from file
__version__ = 'unknown'
exec(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "__version__.py")).read())
try:
from .__ducobox_version__ import version as ducobox_version
except ImportError:
ducobox_version = 'version not available from scm'

__version__ = ducobox_version

DEFAULT_LOGLEVEL = 'info'
DEFAULT_INTERVAL = 300
Expand Down

0 comments on commit b4a7065

Please sign in to comment.