Skip to content

Commit 740cb7f

Browse files
committed
setup.py: Read __version__ from uvloop/__init__.py
Fixes #137.
1 parent a637877 commit 740cb7f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

setup.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
raise RuntimeError('uvloop requires Python 3.5 or 3.6b3 or greater')
2323

2424

25-
VERSION = '0.9.2.dev0'
2625
CFLAGS = ['-O2']
2726
LIBUV_DIR = os.path.join(os.path.dirname(__file__), 'vendor', 'libuv')
2827
LIBUV_BUILD_DIR = os.path.join(os.path.dirname(__file__), 'build', 'libuv')
@@ -211,6 +210,18 @@ def build_extensions(self):
211210
readme = f.read()
212211

213212

213+
with open(os.path.join(
214+
os.path.dirname(__file__), 'uvloop', '__init__.py')) as f:
215+
for line in f:
216+
if line.startswith('__version__ ='):
217+
_, _, version = line.partition('=')
218+
VERSION = version.strip(" \n'\"")
219+
break
220+
else:
221+
raise RuntimeError(
222+
'unable to read the version from uvloop/__init__.py')
223+
224+
214225
setup(
215226
name='uvloop',
216227
description='Fast implementation of asyncio event loop on top of libuv',

uvloop/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .loop import Loop as __BaseLoop # NOQA
88

99

10+
__version__ = '0.9.2.dev0'
1011
__all__ = ('new_event_loop', 'EventLoopPolicy')
1112

1213

0 commit comments

Comments
 (0)