Rev 4730: (arkanes) Add Cython support in setup.py if Pyrex is not found. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Oct 6 19:58:48 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4730 [merge]
revision-id: pqm at pqm.ubuntu.com-20091006185842-58f209ak0u65zzr8
parent: pqm at pqm.ubuntu.com-20091006173741-37lpt4t94xmt9ckt
parent: john at arbash-meinel.com-20091006175645-st2osgp5gw4go4y3
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2009-10-06 19:58:42 +0100
message:
  (arkanes) Add Cython support in setup.py if Pyrex is not found.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
=== modified file 'NEWS'
--- a/NEWS	2009-10-06 15:58:12 +0000
+++ b/NEWS	2009-10-06 18:58:42 +0000
@@ -37,6 +37,10 @@
   automatically benefit from this feature when ``bzr`` on the server is
   upgraded.  (Andrew Bennetts, #109143)
 
+* Extensions can now be compiled if either Cython or Pyrex is available.
+  Currently Pyrex is preferred, but that may change in the future.
+  (Arkanes)
+
 * Give more control on BZR_PLUGIN_PATH by providing a way to refer to or
   disable the user, site and core plugin directories.
   (Vincent Ladeuil, #412930, #316192, #145612)

=== modified file 'setup.py'
--- a/setup.py	2009-09-15 07:39:18 +0000
+++ b/setup.py	2009-10-01 03:46:41 +0000
@@ -167,7 +167,13 @@
 from distutils.extension import Extension
 ext_modules = []
 try:
-    from Pyrex.Distutils import build_ext
+    try:
+        from Pyrex.Distutils import build_ext
+        from Pyrex.Compiler.Version import version as pyrex_version
+    except ImportError:
+        print "No Pyrex, trying Cython..."
+        from Cython.Distutils import build_ext
+        from Cython.Compiler.Version import version as pyrex_version
 except ImportError:
     have_pyrex = False
     # try to build the extension from the prior generated source.
@@ -180,7 +186,6 @@
     from distutils.command.build_ext import build_ext
 else:
     have_pyrex = True
-    from Pyrex.Compiler.Version import version as pyrex_version
 
 
 class build_ext_if_possible(build_ext):




More information about the bazaar-commits mailing list