diff -r a7f794de3cc6 -r 03d4d276af09 Cython/Compiler/Main.py
--- a/Cython/Compiler/Main.py	Sat Sep 26 22:30:33 2009 -0700
+++ b/Cython/Compiler/Main.py	Sun Nov 01 15:14:14 2009 +0900
@@ -721,6 +721,8 @@
 #  Main command-line entry point
 #
 #------------------------------------------------------------------------
+def setuptools_main():
+    return main(command_line = 1)
 
 def main(command_line = 0):
     args = sys.argv[1:]
diff -r a7f794de3cc6 -r 03d4d276af09 setup.py
--- a/setup.py	Sat Sep 26 22:30:33 2009 -0700
+++ b/setup.py	Sun Nov 01 15:14:14 2009 +0900
@@ -29,10 +29,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:
     sys.argv.remove("--no-cython-compile")
@@ -74,6 +88,7 @@
         print("ERROR: %s" % sys.exc_info()[1])
         print("Extension module compilation failed, using plain Python implementation")
 
+setup_args.update(setuptools_extra_args)
 
 setup(
   name = 'Cython',
diff -r a7f794de3cc6 -r 03d4d276af09 setupegg.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/setupegg.py	Sun Nov 01 15:14:14 2009 +0900
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+"""Wrapper to run setup.py using setuptools."""
+import setuptools
+execfile('setup.py')
