setup.py: Change USE_CYTHON env var to DISABLE_CYTHON
Compiling from Cython source is now the default and disabled when not installed
This commit is contained in:
parent
1466ea7207
commit
922a2ae893
87
setup.py
87
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"
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
else:
|
||||
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:
|
||||
module_suffix = ".c"
|
||||
from distutils.command.build_ext import build_ext
|
||||
|
||||
def cythonize(modules, *args, **kwargs):
|
||||
return modules
|
||||
else:
|
||||
module_suffix = ".pyx"
|
||||
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
|
||||
|
||||
|
||||
class CleanGenerated(Command):
|
||||
|
|
Loading…
Reference in New Issue