kuuko pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=339b87ab874ae073126316f7cb17de68905b4843

commit 339b87ab874ae073126316f7cb17de68905b4843
Author: Kai Huuhko <kai.huu...@gmail.com>
Date:   Fri Apr 18 01:43:18 2014 +0300

    setup.py: Fall back to a relaxed check for Cython version
    
    If StrictVersion doesn't understand the version string we
    fall back to LooseVersion. This should work with version strings
    such as 0.20.1post0
---
 setup.py | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/setup.py b/setup.py
index 822be2c..897dcf4 100755
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ import sys
 import subprocess
 from distutils.core import setup, Command
 from distutils.extension import Extension
-from distutils.version import StrictVersion
+from distutils.version import StrictVersion, LooseVersion
 
 script_path = os.path.dirname(os.path.abspath(__file__))
 
@@ -76,20 +76,36 @@ def pkg_config(name, require, min_vers=None):
 
 # use cython or pre-generated c files
 if os.path.exists(os.path.join(script_path, "efl", "eo", "efl.eo.pyx")):
+
     module_suffix = ".pyx"
+
     try:
         from Cython.Distutils import build_ext
         from Cython.Build import cythonize
         import Cython.Compiler.Options
+    except ImportError:
+        raise SystemExit("Requires Cython >= %s (http://cython.org/)" % 
CYTHON_MIN_VERSION)
 
-        assert StrictVersion(Cython.__version__) >= 
StrictVersion(CYTHON_MIN_VERSION)
-        Cython.Compiler.Options.fast_fail = True # Stop compilation on first 
error
-        Cython.Compiler.Options.annotate = False # Generates HTML files with 
annotated source
-        Cython.Compiler.Options.docstrings = True # Set to False to disable 
docstrings
+    try:
+        try:
+            assert StrictVersion(Cython.__version__) >= 
StrictVersion(CYTHON_MIN_VERSION)
+        except ValueError:
+            print("Your Cython version string (%s) is weird. We'll attempt to "
+                "check that it's higher than the minimum required: %s, but 
this "
+                "is unreliable.\n"
+                "If you run into any problems during or after installation it 
may "
+                "be caused by version of Cython that's too old." % (
+                    Cython.__version__, CYTHON_MIN_VERSION
+                    )
+                )
+            assert LooseVersion(Cython.__version__) >= 
LooseVersion(CYTHON_MIN_VERSION)
+    except AssertionError:
+        raise SystemExit("Requires Cython >= %s (http://cython.org/)" % 
CYTHON_MIN_VERSION)
+
+    Cython.Compiler.Options.fast_fail = True # Stop compilation on first error
+    Cython.Compiler.Options.annotate = False # Generates HTML files with 
annotated source
+    Cython.Compiler.Options.docstrings = True # Set to False to disable 
docstrings
 
-    except (ImportError, AssertionError):
-        print("Requires Cython >= %s (http://cython.org/)" % 
CYTHON_MIN_VERSION)
-        raise
 else:
     module_suffix = ".c"
     from distutils.command.build_ext import build_ext

-- 


Reply via email to