diff options
author | David Cournapeau <cournape@gmail.com> | 2009-11-10 22:41:07 -0800 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-11-10 22:41:07 -0800 |
commit | 0855d80eec1435f0d4bd656271164077c19f0f07 (patch) | |
tree | 57625a9f1848cddc2e41ca88015c9f068af179ce | |
parent | 8b27f1d8f0949421163a0bd00d2725a6434ff183 (diff) | |
download | cython-0855d80eec1435f0d4bd656271164077c19f0f07.tar.gz |
Optional setuptools-based cython build
-rw-r--r-- | Cython/Compiler/Main.py | 2 | ||||
-rw-r--r-- | setup.py | 21 | ||||
-rw-r--r-- | setupegg.py | 4 |
3 files changed, 24 insertions, 3 deletions
diff --git a/Cython/Compiler/Main.py b/Cython/Compiler/Main.py index 67a8a1daf..1bc90028c 100644 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@ -741,6 +741,8 @@ def compile(source, options = None, c_compile = 0, c_link = 0, # Main command-line entry point # #------------------------------------------------------------------------ +def setuptools_main(): + return main(command_line = 1) def main(command_line = 0): args = sys.argv[1:] @@ -40,10 +40,24 @@ else: 'Compiler/*.pxd', 'Runtime/*.pyx']} -if os.name == "posix": - scripts = ["bin/cython"] +# This dict is used for passing extra arguments that are setuptools +# 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: - scripts = ["cython.py"] + if os.name == "posix": + scripts = ["bin/cython"] + else: + scripts = ["cython.py"] + try: if sys.version_info[0] >= 3: @@ -93,6 +107,7 @@ except ValueError: print("ERROR: %s" % sys.exc_info()[1]) print("Extension module compilation failed, using plain Python implementation") +setup_args.update(setuptools_extra_args) from Cython.Compiler.Version import version diff --git a/setupegg.py b/setupegg.py new file mode 100644 index 000000000..cf97861b3 --- /dev/null +++ b/setupegg.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +"""Wrapper to run setup.py using setuptools.""" +import setuptools +execfile('setup.py') |