Skip to content

Commit

Permalink
shorter and faster version extraction from __init__.py
Browse files Browse the repository at this point in the history
deronnax committed Mar 25, 2015
1 parent e95e173 commit ce234d5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -30,12 +30,8 @@

version = ''
with open('requests/__init__.py', 'r') as fd:
reg = re.compile(r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]')
for line in fd:
m = reg.match(line)
if m:
version = m.group(1)
break
version = re.search(r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read()).group(1)

if not version:
raise RuntimeError('Cannot find version information')

0 comments on commit ce234d5

Please sign in to comment.