kuuko pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=922a2ae8933ab4a4ebad713f2e00eb796c25ea14

commit 922a2ae8933ab4a4ebad713f2e00eb796c25ea14
Author: Kai Huuhko <[email protected]>
Date:   Tue May 13 21:59:15 2014 +0300

    setup.py: Change USE_CYTHON env var to DISABLE_CYTHON
    
    Compiling from Cython source is now the default and disabled
    when not installed
---
 setup.py | 75 ++++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 37 insertions(+), 38 deletions(-)

diff --git a/setup.py b/setup.py
index 73b12f9..c8c25cc 100755
--- a/setup.py
+++ b/setup.py
@@ -94,55 +94,54 @@ def pkg_config(name, require, min_vers=None):
 
 # use cython or pre-generated c files
 
-if os.getenv("USE_CYTHON") or \
-    not os.path.exists(
-        os.path.join(script_path, "efl", "eo", "efl.eo.c")
-        ):
-
-    module_suffix = ".pyx"
+if os.getenv("DISABLE_CYTHON"):
+    module_suffix = ".c"
+    from distutils.command.build_ext import build_ext
 
+    def cythonize(modules, *args, **kwargs):
+        return modules
+else:
     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
-        )
+        module_suffix = ".c"
+        from distutils.command.build_ext import build_ext
 
-    try:
+        def cythonize(modules, *args, **kwargs):
+            return modules
+    else:
+        module_suffix = ".pyx"
         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." % (
+            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
+                    )
                 )
-            )
-            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
-
-else:
-    module_suffix = ".c"
-    from distutils.command.build_ext import build_ext
 
-    def cythonize(modules, *args, **kwargs):
-        return modules
+        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
 
 
 class CleanGenerated(Command):

-- 


Reply via email to