Skip to content

Commit 204889e

Browse files
author
brentru
committed
created a single-source for package vers.
1 parent 0cd3180 commit 204889e

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Adafruit_IO/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
from .mqtt_client import MQTTClient
2323
from .errors import AdafruitIOError, RequestError, ThrottlingError
2424
from .model import Data, Stream, Feed, Group
25+
from _version import __version__

_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "2.0.0"

setup.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
from ez_setup import use_setuptools
22
use_setuptools()
3-
from setuptools import setup
3+
from setuptools import setup, find_packages
4+
import re
5+
6+
VERSIONFILE="_version.py"
7+
verstrline = open(VERSIONFILE, "rt").read()
8+
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
9+
mo = re.search(VSRE, verstrline, re.M)
10+
if mo:
11+
verstr = mo.group(1)
12+
else:
13+
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))
14+
print('version: ', verstr)
415

516
classifiers = ['Development Status :: 4 - Beta',
617
'Operating System :: POSIX :: Linux',
@@ -16,7 +27,7 @@
1627

1728
setup(
1829
name = 'adafruit-io',
19-
version = '2.0.0',
30+
version = verstr,
2031
author = 'Justin Cooper',
2132
author_email = '[email protected]',
2233
packages = ['Adafruit_IO'],

0 commit comments

Comments
 (0)