Skip to content

Commit

Permalink
setup.py: Read __version__ from uvloop/__init__.py
Browse files Browse the repository at this point in the history
Fixes #137.
  • Loading branch information
1st1 committed May 30, 2018
1 parent a637877 commit 740cb7f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
raise RuntimeError('uvloop requires Python 3.5 or 3.6b3 or greater')


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


with open(os.path.join(
os.path.dirname(__file__), 'uvloop', '__init__.py')) as f:
for line in f:
if line.startswith('__version__ ='):
_, _, version = line.partition('=')
VERSION = version.strip(" \n'\"")
break
else:
raise RuntimeError(
'unable to read the version from uvloop/__init__.py')


setup(
name='uvloop',
description='Fast implementation of asyncio event loop on top of libuv',
Expand Down
1 change: 1 addition & 0 deletions uvloop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .loop import Loop as __BaseLoop # NOQA


__version__ = '0.9.2.dev0'
__all__ = ('new_event_loop', 'EventLoopPolicy')


Expand Down

0 comments on commit 740cb7f

Please sign in to comment.