summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2014-05-13 21:59:15 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2014-05-13 22:02:34 +0300
commit922a2ae8933ab4a4ebad713f2e00eb796c25ea14 (patch)
tree8fd3b1da75aa2345dd8171a2790cdbb40f7ad6cc
parent1466ea72071e27380e6d86de4d1712e587fce3b3 (diff)
setup.py: Change USE_CYTHON env var to DISABLE_CYTHON
Compiling from Cython source is now the default and disabled when not installed
-rwxr-xr-xsetup.py75
1 files 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):
94 94
95# use cython or pre-generated c files 95# use cython or pre-generated c files
96 96
97if os.getenv("USE_CYTHON") or \ 97if os.getenv("DISABLE_CYTHON"):
98 not os.path.exists( 98 module_suffix = ".c"
99 os.path.join(script_path, "efl", "eo", "efl.eo.c") 99 from distutils.command.build_ext import build_ext
100 ):
101
102 module_suffix = ".pyx"
103 100
101 def cythonize(modules, *args, **kwargs):
102 return modules
103else:
104 try: 104 try:
105 from Cython.Distutils import build_ext 105 from Cython.Distutils import build_ext
106 from Cython.Build import cythonize 106 from Cython.Build import cythonize
107 import Cython.Compiler.Options 107 import Cython.Compiler.Options
108 except ImportError: 108 except ImportError:
109 raise SystemExit( 109 module_suffix = ".c"
110 "Requires Cython >= %s (http://cython.org/)" % CYTHON_MIN_VERSION 110 from distutils.command.build_ext import build_ext
111 )
112 111
113 try: 112 def cythonize(modules, *args, **kwargs):
113 return modules
114 else:
115 module_suffix = ".pyx"
114 try: 116 try:
115 assert StrictVersion(Cython.__version__) >= \ 117 try:
116 StrictVersion(CYTHON_MIN_VERSION) 118 assert StrictVersion(Cython.__version__) >= \
117 except ValueError: 119 StrictVersion(CYTHON_MIN_VERSION)
118 print( 120 except ValueError:
119 "Your Cython version string (%s) is weird. We'll attempt to " 121 print("""
120 "check that it's higher than the minimum required: %s, but " 122Your Cython version string (%s) is weird. We'll attempt to
121 "this is unreliable.\n" 123check that it's higher than the minimum required: %s, but
122 "If you run into any problems during or after installation it " 124this is unreliable.\n
123 "may be caused by version of Cython that's too old." % ( 125If you run into any problems during or after installation it
126may be caused by version of Cython that's too old.""" % (
124 Cython.__version__, CYTHON_MIN_VERSION 127 Cython.__version__, CYTHON_MIN_VERSION
128 )
129 )
130 assert LooseVersion(Cython.__version__) >= \
131 LooseVersion(CYTHON_MIN_VERSION)
132 except AssertionError:
133 raise SystemExit(
134 "Requires Cython >= %s (http://cython.org/)" % (
135 CYTHON_MIN_VERSION
136 )
125 ) 137 )
126 )
127 assert LooseVersion(Cython.__version__) >= \
128 LooseVersion(CYTHON_MIN_VERSION)
129 except AssertionError:
130 raise SystemExit(
131 "Requires Cython >= %s (http://cython.org/)" % CYTHON_MIN_VERSION
132 )
133
134 Cython.Compiler.Options.fast_fail = True # Stop compilation on first error
135 Cython.Compiler.Options.annotate = False # Generates HTML files with
136 # annotated source
137 Cython.Compiler.Options.docstrings = True # Set to False to disable
138 # docstrings
139
140else:
141 module_suffix = ".c"
142 from distutils.command.build_ext import build_ext
143 138
144 def cythonize(modules, *args, **kwargs): 139 Cython.Compiler.Options.fast_fail = True # Stop compilation on first
145 return modules 140 # error
141 Cython.Compiler.Options.annotate = False # Generates HTML files with
142 # annotated source
143 Cython.Compiler.Options.docstrings = True # Set to False to disable
144 # docstrings
146 145
147 146
148class CleanGenerated(Command): 147class CleanGenerated(Command):