Rev 3732: (robertc) Allow C extensions to build on python2.4 with older pyrex in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Sep 24 06:10:36 BST 2008


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

------------------------------------------------------------
revno: 3732
revision-id: pqm at pqm.ubuntu.com-20080924051033-89pfepccns2637pr
parent: pqm at pqm.ubuntu.com-20080924014325-ucivgbdmsbuthnqw
parent: robertc at robertcollins.net-20080924041503-5kt95yad0omycqqa
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-09-24 06:10:33 +0100
message:
  (robertc) Allow C extensions to build on python2.4 with older pyrex
  	versions. (Robert Collins)
added:
  bzrlib/python-compat.h         pythoncompat.h-20080924041409-9kvi0fgtuuqp743j-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/_btree_serializer_c.pyx _parse_btree_c.pyx-20080703034413-3q25bklkenti3p8p-2
  bzrlib/_dirstate_helpers_c.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
  bzrlib/_readdir_pyx.pyx        readdir.pyx-20060609152855-rm6v321vuaqyh9tu-1
    ------------------------------------------------------------
    revno: 3731.1.1
    revision-id: robertc at robertcollins.net-20080924041503-5kt95yad0omycqqa
    parent: pqm at pqm.ubuntu.com-20080924014325-ucivgbdmsbuthnqw
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: python2.4
    timestamp: Wed 2008-09-24 14:15:03 +1000
    message:
       * The C extensions now build on python 2.4 (Robert Collins, #271939)
    added:
      bzrlib/python-compat.h         pythoncompat.h-20080924041409-9kvi0fgtuuqp743j-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/_btree_serializer_c.pyx _parse_btree_c.pyx-20080703034413-3q25bklkenti3p8p-2
      bzrlib/_dirstate_helpers_c.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
      bzrlib/_readdir_pyx.pyx        readdir.pyx-20060609152855-rm6v321vuaqyh9tu-1
=== modified file 'NEWS'
--- a/NEWS	2008-09-24 00:09:49 +0000
+++ b/NEWS	2008-09-24 04:15:03 +0000
@@ -43,6 +43,8 @@
       will not encounter this as it is single threaded for working tree
       operations. (Robert Collins)
 
+    * The C extensions now build on python 2.4 (Robert Collins, #271939)
+
   BUG FIXES:
 
     * Branching from a shared repository on a smart server into a new

=== modified file 'bzrlib/_btree_serializer_c.pyx'
--- a/bzrlib/_btree_serializer_c.pyx	2008-08-22 03:54:29 +0000
+++ b/bzrlib/_btree_serializer_c.pyx	2008-09-24 04:15:03 +0000
@@ -17,6 +17,10 @@
 
 """Pyrex extensions to btree node parsing."""
 
+#python2.4 support
+cdef extern from "python-compat.h":
+    pass
+
 cdef extern from "stdlib.h":
     ctypedef unsigned size_t
 

=== modified file 'bzrlib/_dirstate_helpers_c.pyx'
--- a/bzrlib/_dirstate_helpers_c.pyx	2008-09-02 19:15:57 +0000
+++ b/bzrlib/_dirstate_helpers_c.pyx	2008-09-24 04:15:03 +0000
@@ -23,6 +23,10 @@
 from bzrlib.dirstate import DirState
 
 
+#python2.4 support
+cdef extern from "python-compat.h":
+    pass
+
 # Give Pyrex some function definitions for it to understand.
 # All of these are just hints to Pyrex, so that it can try to convert python
 # objects into similar C objects. (such as PyInt => int).

=== modified file 'bzrlib/_readdir_pyx.pyx'
--- a/bzrlib/_readdir_pyx.pyx	2008-09-23 23:28:27 +0000
+++ b/bzrlib/_readdir_pyx.pyx	2008-09-24 04:15:03 +0000
@@ -20,6 +20,10 @@
 import os
 import sys
 
+#python2.4 support
+cdef extern from "python-compat.h":
+    pass
+
 
 # the opaque C library DIR type.
 cdef extern from 'errno.h':

=== added file 'bzrlib/python-compat.h'
--- a/bzrlib/python-compat.h	1970-01-01 00:00:00 +0000
+++ b/bzrlib/python-compat.h	2008-09-24 04:15:03 +0000
@@ -0,0 +1,36 @@
+/*
+ *  Bazaar -- distributed version control
+ *
+ * Copyright (C) 2008 by Canonical Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/* Provide the typedefs that pyrex does automatically in newer versions, to
+ * allow older versions  to build our extensions.
+ */
+
+#ifndef _BZR_PYTHON_COMPAT_H
+#define _BZR_PYTHON_COMPAT_H
+
+#if PY_VERSION_HEX < 0x02050000
+  typedef int Py_ssize_t;
+    #define PY_SSIZE_T_MAX INT_MAX
+    #define PY_SSIZE_T_MIN INT_MIN
+    #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
+    #define PyInt_AsSsize_t(o) PyInt_AsLong(o)
+#endif
+
+#endif




More information about the bazaar-commits mailing list