Skip to content

Commit c5695f4

Browse files
xsleonardmaxcountryman
authored andcommitted
remove ImportError hack for __version__
1 parent 27f331e commit c5695f4

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

rauth/__about__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__title__ = 'rauth'
2+
__version_info__ = ('0', '6', '2')
3+
__version__ = '.'.join(__version_info__)
4+
__author__ = 'Max Countryman'
5+
__license__ = 'MIT'
6+
__copyright__ = 'Copyright 2013 litl'

rauth/__init__.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,13 @@
1616
1717
'''
1818

19-
__title__ = 'rauth'
20-
__version_info__ = ('0', '6', '2')
21-
__version__ = '.'.join(__version_info__)
22-
__author__ = 'Max Countryman'
23-
__license__ = 'MIT'
24-
__copyright__ = 'Copyright 2013 litl'
2519
__all__ = ['OAuth1Service', 'OAuth2Service', 'OflyService', 'OAuth1Session',
2620
'OAuth2Session', 'OflySession']
2721

28-
# HACK: setup workaround for the need to have Requests at runtime
29-
try:
30-
from .service import OAuth1Service, OAuth2Service, OflyService
31-
from .session import OAuth1Session, OAuth2Session, OflySession
22+
from .service import OAuth1Service, OAuth2Service, OflyService
23+
from .session import OAuth1Session, OAuth2Session, OflySession
24+
from .__about__ import (__title__, __version_info__, __version__, __author__,
25+
__license__, __copyright__)
3226

33-
# placate pyflakes
34-
(OAuth1Service, OAuth2Service, OflyService, OAuth1Session, OAuth2Session,
35-
OflySession)
36-
except ImportError: # pragma: no cover
37-
pass
27+
(__title__, __version_info__, __version__, __author__, __license__,
28+
__copyright__) # silence pep8 "imported but unused"

setup.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
import os
1515
import sys
1616

17-
from rauth import __version__
18-
1917
from setuptools import setup, find_packages
2018

19+
about = {}
20+
with open('rauth/__about__.py') as f:
21+
exec(f.read(), about)
22+
2123
if sys.argv[-1] == 'test':
2224
status = os.system('make check')
2325
status >>= 8
@@ -46,16 +48,16 @@
4648
'Topic :: Software Development :: Libraries :: Python Modules',
4749
'Topic :: Utilities']
4850

49-
setup(name='rauth',
50-
version=__version__,
51+
setup(name=about['__title__'],
52+
version=about['__version__'],
5153
description='A Python library for OAuth 1.0/a, 2.0, and Ofly.',
5254
long_description=__doc__,
53-
author='Max Countryman',
55+
author=about['__author__'],
5456
author_email='[email protected]',
5557
url='https://github.com/litl/rauth',
5658
packages=find_packages(),
5759
install_requires=install_requires,
58-
license='MIT',
60+
license=about['__license__'],
5961
keywords='oauth oauth2 rauth requests',
6062
classifiers=classifiers,
6163
zip_safe=False)

0 commit comments

Comments
 (0)