Skip to content

Commit efd1613

Browse files
committed
Move version information to __init__.py
1 parent f9ff2ea commit efd1613

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
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',

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)