Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Optional setuptools-based cython build

  • Loading branch information...
commit 0855d80eec1435f0d4bd656271164077c19f0f07 1 parent 8b27f1d
@cournape cournape authored
Showing with 24 additions and 3 deletions.
  1. +2 −0  Cython/Compiler/Main.py
  2. +18 −3 setup.py
  3. +4 −0 setupegg.py
View
2  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:]
View
21 setup.py
@@ -40,10 +40,24 @@
'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 @@ def build_extension(self, ext, *args, **kargs):
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
View
4 setupegg.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+"""Wrapper to run setup.py using setuptools."""
+import setuptools
+execfile('setup.py')
Please sign in to comment.
Something went wrong with that request. Please try again.