From d8729aa63048e0297fd933c66a79c28f4e86da14 Mon Sep 17 00:00:00 2001 From: Benn Snyder Date: Tue, 6 Jan 2015 17:28:35 -0700 Subject: [PATCH] python: Fix version detection python: Use list comprehension so setup.py runs on python3 - fixes #429 Signed-off-by: Benn Snyder --- wrappers/python/setup.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wrappers/python/setup.py b/wrappers/python/setup.py index 40a0f93c..005d4da5 100755 --- a/wrappers/python/setup.py +++ b/wrappers/python/setup.py @@ -14,10 +14,16 @@ def get_cython_version(): ImportError: Can't load cython or find version """ import Cython.Compiler.Main - match = re.search('^([0-9]+)\.([0-9]+)', - Cython.Compiler.Main.Version.version) + + try: + # old way, fails for me + version = Cython.Compiler.Main.Version.version + except AttributeError: + version = Cython.Compiler.Main.version + + match = re.search('^([0-9]+)\.([0-9]+)', version) try: - return map(int, match.groups()) + return [int(g) for g in match.groups()] except AttributeError: raise ImportError