Skip to content
Myr

shorter and faster version extraction from __init__.py

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by deronnax · committed by deronnax · parent e95e173 · Browse files · 1 file+2 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−6 removed

  • other:+2 added−6 removed

1 file+2 added−6 removed

modified:setup.py+2 added-6 removed
28 unmodified lines
29requires = []3031version = ''32with open('requests/__init__.py', 'r') as fd:33 reg = re.compile(r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]')34 for line in fd:35 m = reg.match(line)36 if m:37 version = m.group(1)38 break33 version = re.search(r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]',34 fd.read()).group(1)3536if not version:37 raise RuntimeError('Cannot find version information')38
36 unmodified lines