Commit d1b9dda7 authored by Stefan Behnel's avatar Stefan Behnel

Add a "minimal compile" build mode that speeds up the compiler somewhat but...

Add a "minimal compile" build mode that speeds up the compiler somewhat but keeps the number of compiled modules low.
parent 8b3c3733
...@@ -79,24 +79,27 @@ else: ...@@ -79,24 +79,27 @@ else:
scripts = ["cython.py", "cythonize.py", "cygdb.py"] scripts = ["cython.py", "cythonize.py", "cygdb.py"]
def compile_cython_modules(profile=False, coverage=False, compile_more=False, cython_with_refnanny=False): def compile_cython_modules(profile=False, coverage=False, compile_minimal=False, compile_more=False, cython_with_refnanny=False):
source_root = os.path.abspath(os.path.dirname(__file__)) source_root = os.path.abspath(os.path.dirname(__file__))
compiled_modules = [ compiled_modules = [
"Cython.Plex.Scanners",
"Cython.Plex.Actions", "Cython.Plex.Actions",
"Cython.Plex.Machines", "Cython.Plex.Scanners",
"Cython.Plex.Transitions",
"Cython.Plex.DFA",
"Cython.Compiler.Scanning", "Cython.Compiler.Scanning",
"Cython.Compiler.Visitor", "Cython.Compiler.Visitor",
"Cython.Compiler.FlowControl",
"Cython.Runtime.refnanny", "Cython.Runtime.refnanny",
"Cython.Compiler.FusedNode",
"Cython.Tempita._tempita",
"Cython.StringIOTree",
"Cython.Utils",
] ]
if compile_more: if not compile_minimal:
compiled_modules.extend([
"Cython.Plex.Machines",
"Cython.Plex.Transitions",
"Cython.Plex.DFA",
"Cython.Compiler.FlowControl",
"Cython.Compiler.FusedNode",
"Cython.Tempita._tempita",
"Cython.StringIOTree",
"Cython.Utils",
])
if compile_more and not compile_minimal:
compiled_modules.extend([ compiled_modules.extend([
"Cython.Compiler.Code", "Cython.Compiler.Code",
"Cython.Compiler.Lexicon", "Cython.Compiler.Lexicon",
...@@ -136,7 +139,7 @@ def compile_cython_modules(profile=False, coverage=False, compile_more=False, cy ...@@ -136,7 +139,7 @@ def compile_cython_modules(profile=False, coverage=False, compile_more=False, cy
defines = [] defines = []
if cython_with_refnanny: if cython_with_refnanny:
defines.append(('CYTHON_REFNANNY', '1')) defines.append(('CYTHON_REFNANNY', '1'))
if coverage: if coverage:
defines.append(('CYTHON_TRACE', '1')) defines.append(('CYTHON_TRACE', '1'))
extensions = [] extensions = []
...@@ -194,6 +197,12 @@ try: ...@@ -194,6 +197,12 @@ try:
except ValueError: except ValueError:
cython_compile_more = False cython_compile_more = False
try:
sys.argv.remove("--cython-compile-minimal")
cython_compile_minimal = True
except ValueError:
cython_compile_minimal = False
try: try:
sys.argv.remove("--cython-with-refnanny") sys.argv.remove("--cython-with-refnanny")
cython_with_refnanny = True cython_with_refnanny = True
...@@ -239,8 +248,8 @@ packages = [ ...@@ -239,8 +248,8 @@ packages = [
def run_build(): def run_build():
if compile_cython_itself and (is_cpython or cython_compile_more): if compile_cython_itself and (is_cpython or cython_compile_more or cython_compile_minimal):
compile_cython_modules(cython_profile, cython_coverage, cython_compile_more, cython_with_refnanny) compile_cython_modules(cython_profile, cython_coverage, cython_compile_minimal, cython_compile_more, cython_with_refnanny)
from Cython import __version__ as version from Cython import __version__ as version
setup( setup(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment