Debugger: Don't run test suite if GDB python version < 2.6
[cython.git] / setup.py
index e1f28e6d0cfd877ea75d03bfc52d7b1dd1d2665f..8bc76151352d016c80ab1a563ab4afd1436d4f89 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,15 +3,8 @@ from distutils.sysconfig import get_python_lib
 import os, os.path
 import sys
 
-if 'sdist' in sys.argv and sys.platform != "win32" and sys.version_info >= (2,4):
-    # Record the current revision in .hgrev
-    import subprocess # os.popen is cleaner but deprecated
-    changeset = subprocess.Popen("hg identify --id --rev tip".split(),
-                                 stdout=subprocess.PIPE).stdout.read()
-    rev = changeset.decode('ISO-8859-1').strip()
-    hgrev = open('.hgrev', 'w')
-    hgrev.write(rev)
-    hgrev.close()
+if 'sdist' in sys.argv and sys.platform != "win32":
+    assert os.system("git show-ref -s HEAD > .gitrev") == 0
 
 if sys.platform == "darwin":
     # Don't create resource files on OS X tar.
@@ -66,10 +59,13 @@ else:
         'Cython'          : [ p[7:] for p in pxd_include_patterns ],
         }
 
-# This dict is used for passing extra arguments that are setuptools 
+# This dict is used for passing extra arguments that are setuptools
 # specific to setup
 setuptools_extra_args = {}
 
+# tells whether to include cygdb (the script and the Cython.Debugger package
+include_debugger = sys.version_info[:2] > (2, 5)
+
 if 'setuptools' in sys.modules:
     setuptools_extra_args['zip_safe'] = False
     setuptools_extra_args['entry_points'] = {
@@ -80,18 +76,24 @@ if 'setuptools' in sys.modules:
     scripts = []
 else:
     if os.name == "posix":
-        scripts = ["bin/cython", "bin/cygdb"]
+        scripts = ["bin/cython"]
+        if include_debugger:
+            scripts.append('bin/cygdb')
     else:
-        scripts = ["cython.py", "cygdb.py"]
+        scripts = ["cython.py"]
+        if include_debugger:
+            scripts.append('cygdb.py')
 
 def compile_cython_modules(profile=False, compile_more=False, cython_with_refnanny=False):
     source_root = os.path.abspath(os.path.dirname(__file__))
     compiled_modules = ["Cython.Plex.Scanners",
                         "Cython.Plex.Actions",
+                        "Cython.Compiler.Lexicon",
                         "Cython.Compiler.Scanning",
                         "Cython.Compiler.Parsing",
                         "Cython.Compiler.Visitor",
-                        "Cython.Runtime.refnanny"]
+                        "Cython.Compiler.Code",
+                        "Cython.Runtime.refnanny",]
     if compile_more:
         compiled_modules.extend([
             "Cython.Compiler.ParseTreeTransforms",
@@ -247,6 +249,25 @@ setup_args.update(setuptools_extra_args)
 
 from Cython import __version__ as version
 
+packages = [
+    'Cython',
+    'Cython.Build',
+    'Cython.Compiler',
+    'Cython.Runtime',
+    'Cython.Distutils',
+    'Cython.Plex',
+    'Cython.Tests',
+    'Cython.Build.Tests',
+    'Cython.Compiler.Tests',
+]
+
+if include_debugger:
+    packages.append('Cython.Debugger')
+    packages.append('Cython.Debugger.Tests')
+    # it's enough to do this for Py2.5+:
+    setup_args['package_data']['Cython.Debugger.Tests'] = ['codefile', 'cfuncs.c']
+
+
 setup(
   name = 'Cython',
   version = version,
@@ -287,17 +308,7 @@ setup(
   ],
 
   scripts = scripts,
-  packages=[
-    'Cython',
-    'Cython.Build',
-    'Cython.Compiler',
-    'Cython.Runtime',
-    'Cython.Distutils',
-    'Cython.Plex',
-    'Cython.Debugger',
-    'Cython.Tests',
-    'Cython.Compiler.Tests',
-    ],
+  packages=packages,
 
   # pyximport
   py_modules = ["pyximport/__init__",