Skip to content

Commit d8729aa

Browse files
committed
python: Fix version detection
python: Use list comprehension so setup.py runs on python3 - fixes #429 Signed-off-by: Benn Snyder <[email protected]>
1 parent e551c9a commit d8729aa

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

wrappers/python/setup.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ def get_cython_version():
1414
ImportError: Can't load cython or find version
1515
"""
1616
import Cython.Compiler.Main
17-
match = re.search('^([0-9]+)\.([0-9]+)',
18-
Cython.Compiler.Main.Version.version)
17+
18+
try:
19+
# old way, fails for me
20+
version = Cython.Compiler.Main.Version.version
21+
except AttributeError:
22+
version = Cython.Compiler.Main.version
23+
24+
match = re.search('^([0-9]+)\.([0-9]+)', version)
1925
try:
20-
return map(int, match.groups())
26+
return [int(g) for g in match.groups()]
2127
except AttributeError:
2228
raise ImportError
2329

0 commit comments

Comments
 (0)