Skip to content

Commit 33f26ec

Browse files
Merge pull request #40 from nioinnovation/versioning
Make versioning work in __init__.py
2 parents f9ff2ea + d41b928 commit 33f26ec

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

setup.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
1+
import re
12
from setuptools import setup, find_packages
23

4+
# Auto detect the library version from the __init__.py file
5+
with open('xbee/__init__.py', 'r') as fd:
6+
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
7+
fd.read(), re.MULTILINE).group(1)
8+
if not version:
9+
raise RuntimeError('Cannot find version information')
10+
311
setup(
412
name='XBee',
5-
version='2.2.4',
13+
version=version,
614
description='Python tools for working with XBee radios',
715
long_description=open('README.rst').read(),
816
url='https://github.com/nioinnovation/python-xbee',
9-
author='Paul Malmsten',
10-
author_email='pmalmsten@gmail.com',
17+
author='n.io',
18+
author_email='info@n.io',
1119
license='MIT',
1220
classifiers=[
1321
'Development Status :: 5 - Production/Stable',
1422
'Intended Audience :: Developers',
1523
'License :: OSI Approved :: MIT License',
1624
'Topic :: Terminals :: Serial',
1725
'Programming Language :: Python',
18-
'Programming Language :: Python :: 2'
19-
'Programming Language :: Python :: 3'
26+
'Programming Language :: Python :: 2',
27+
'Programming Language :: Python :: 3',
2028
],
2129
packages=find_packages(exclude=['tests', '*.tests']),
2230
install_requires=['pyserial']

xbee/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
"""
22
XBee package initalization file
33
4-
By Paul Malmsten, 2010
5-
pmalmsten@gmail.com
4+
info@n.io
65
"""
76

7+
__title__ = 'xbee'
8+
__version__ = '2.2.4'
9+
__author__ = 'n.io'
10+
__license__ = 'MIT'
11+
812
from xbee.ieee import XBee
913
from xbee.zigbee import ZigBee
1014
from xbee.digimesh import DigiMesh

0 commit comments

Comments
 (0)