Commit 0855d80e authored by David Cournapeau's avatar David Cournapeau

Optional setuptools-based cython build

parent 8b27f1d8
...@@ -741,6 +741,8 @@ def compile(source, options = None, c_compile = 0, c_link = 0, ...@@ -741,6 +741,8 @@ def compile(source, options = None, c_compile = 0, c_link = 0,
# Main command-line entry point # Main command-line entry point
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def setuptools_main():
return main(command_line = 1)
def main(command_line = 0): def main(command_line = 0):
args = sys.argv[1:] args = sys.argv[1:]
......
...@@ -40,10 +40,24 @@ else: ...@@ -40,10 +40,24 @@ else:
'Compiler/*.pxd', 'Compiler/*.pxd',
'Runtime/*.pyx']} 'Runtime/*.pyx']}
if os.name == "posix": # This dict is used for passing extra arguments that are setuptools
scripts = ["bin/cython"] # specific to setup
setuptools_extra_args = {}
if 'setuptools' in sys.modules:
setuptools_extra_args['zip_safe'] = False
setuptools_extra_args['entry_points'] = {
'console_scripts': [
'cython = Cython.Compiler.Main:setuptools_main',
]
}
scripts = []
else: else:
scripts = ["cython.py"] if os.name == "posix":
scripts = ["bin/cython"]
else:
scripts = ["cython.py"]
try: try:
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
...@@ -93,6 +107,7 @@ except ValueError: ...@@ -93,6 +107,7 @@ except ValueError:
print("ERROR: %s" % sys.exc_info()[1]) print("ERROR: %s" % sys.exc_info()[1])
print("Extension module compilation failed, using plain Python implementation") print("Extension module compilation failed, using plain Python implementation")
setup_args.update(setuptools_extra_args)
from Cython.Compiler.Version import version from Cython.Compiler.Version import version
......
#!/usr/bin/env python
"""Wrapper to run setup.py using setuptools."""
import setuptools
execfile('setup.py')
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