Rev 3792: (jam) Allow extensions to compile for python2.4 and using msvc in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Oct 23 18:59:55 BST 2008


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

------------------------------------------------------------
revno: 3792
revision-id: pqm at pqm.ubuntu.com-20081023175952-0gr8np56nf6ab5yn
parent: pqm at pqm.ubuntu.com-20081022201819-s0a7gbf7wrsgn2q7
parent: john at arbash-meinel.com-20081021155356-t9dalqigtvhu4nxw
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-10-23 18:59:52 +0100
message:
  (jam) Allow extensions to compile for python2.4 and using msvc
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/_walkdirs_win32.pyx     _walkdirs_win32.pyx-20080716220454-kweh3tgxez5dvw2l-2
  bzrlib/python-compat.h         pythoncompat.h-20080924041409-9kvi0fgtuuqp743j-1
  bzrlib/win32utils.py           win32console.py-20051021033308-123c6c929d04973d
    ------------------------------------------------------------
    revno: 3788.1.5
    revision-id: john at arbash-meinel.com-20081021155356-t9dalqigtvhu4nxw
    parent: john at arbash-meinel.com-20081021155034-7q4jalz0uhojq4la
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: msvc_python24
    timestamp: Tue 2008-10-21 10:53:56 -0500
    message:
      Use an if \!defined, rather than always assuming they aren't available.
    modified:
      bzrlib/python-compat.h         pythoncompat.h-20080924041409-9kvi0fgtuuqp743j-1
    ------------------------------------------------------------
    revno: 3788.1.4
    revision-id: john at arbash-meinel.com-20081021155034-7q4jalz0uhojq4la
    parent: john at arbash-meinel.com-20081021154929-0i32nlelpfz9m2f7
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: msvc_python24
    timestamp: Tue 2008-10-21 10:50:34 -0500
    message:
      NEWS for fixing bug #277484
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3788.1.3
    revision-id: john at arbash-meinel.com-20081021154929-0i32nlelpfz9m2f7
    parent: john at arbash-meinel.com-20081021153817-9uvj763ty2k9cm1q
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: msvc_python24
    timestamp: Tue 2008-10-21 10:49:29 -0500
    message:
      Extend the compatibility code for MSVC not having most of the stat macros.
    modified:
      bzrlib/python-compat.h         pythoncompat.h-20080924041409-9kvi0fgtuuqp743j-1
    ------------------------------------------------------------
    revno: 3788.1.2
    revision-id: john at arbash-meinel.com-20081021153817-9uvj763ty2k9cm1q
    parent: john at arbash-meinel.com-20081021153644-0drssjf3k1cx1sgq
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: msvc_python24
    timestamp: Tue 2008-10-21 10:38:17 -0500
    message:
      Switch from using cdef readonly __int64 to using a property.
      
      It seems that python2.4 can't handle T_LONGLONG as an implicitly exported
      structure member. So instead, we just export it via property which seems
      to work just fine.
    modified:
      bzrlib/_walkdirs_win32.pyx     _walkdirs_win32.pyx-20080716220454-kweh3tgxez5dvw2l-2
    ------------------------------------------------------------
    revno: 3788.1.1
    revision-id: john at arbash-meinel.com-20081021153644-0drssjf3k1cx1sgq
    parent: pqm at pqm.ubuntu.com-20081021060139-fpwr4fxr2oww2x5o
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: msvc_python24
    timestamp: Tue 2008-10-21 10:36:44 -0500
    message:
      Fix a missing import
    modified:
      bzrlib/win32utils.py           win32console.py-20051021033308-123c6c929d04973d
=== modified file 'NEWS'
--- a/NEWS	2008-10-22 20:18:19 +0000
+++ b/NEWS	2008-10-23 17:59:52 +0000
@@ -51,6 +51,9 @@
       could only happen if ``bzr reconcile`` decided that the parent
       ordering was incorrect in the file graph.  (John Arbash Meinel)
 
+    * Some compatibility fixes for building the extensions with MSVC and
+      for python2.4. (John Arbash Meinel, #277484)
+
   DOCUMENTATION:
 
   API CHANGES:

=== modified file 'bzrlib/_walkdirs_win32.pyx'
--- a/bzrlib/_walkdirs_win32.pyx	2008-09-26 05:14:51 +0000
+++ b/bzrlib/_walkdirs_win32.pyx	2008-10-21 15:38:17 +0000
@@ -81,7 +81,14 @@
     cdef readonly double st_ctime
     cdef readonly double st_mtime
     cdef readonly double st_atime
-    cdef readonly __int64 st_size
+    # We can't just declare this as 'readonly' because python2.4 doesn't define
+    # T_LONGLONG as a structure member. So instead we just use a property that
+    # will convert it correctly anyway.
+    cdef __int64 _st_size
+
+    property st_size:
+        def __get__(self):
+            return self._st_size
 
     # os.stat always returns 0, so we hard code it here
     cdef readonly int st_dev

=== modified file 'bzrlib/python-compat.h'
--- a/bzrlib/python-compat.h	2008-09-26 05:14:51 +0000
+++ b/bzrlib/python-compat.h	2008-10-21 15:53:56 +0000
@@ -35,19 +35,33 @@
 #endif
 
 #if defined(_WIN32) || defined(WIN32)
-    /* Needed for htonl */
-    #include "Winsock.h"
-
     /* Defining WIN32_LEAN_AND_MEAN makes including windows quite a bit
      * lighter weight.
      */
     #define WIN32_LEAN_AND_MEAN
     #include <windows.h>
 
+    /* Needed for htonl */
+    #include "Winsock.h"
+
+    /* sys/stat.h doesn't have any of these macro definitions for MSVC, so
+     * we'll define whatever is missing that we actually use.
+     */
+    #if !defined(S_ISDIR)
+        #define S_ISDIR(m) (((m) & 0170000) == 0040000)
+    #endif
+    #if !defined(S_ISREG)
+        #define S_ISREG(m) (((m) & 0170000) == 0100000)
+    #endif
+    #if !defined(S_IXUSR)
+        #define S_IXUSR 0000100/* execute/search permission, owner */
+    #endif
     /* sys/stat.h doesn't have S_ISLNK on win32, so we fake it by just always
      * returning False
      */
-    #define S_ISLNK(mode) (0)
+    #if !defined(S_ISLNK)
+        #define S_ISLNK(mode) (0)
+    #endif
 #else /* Not win32 */
     /* For htonl */
     #include "arpa/inet.h"

=== modified file 'bzrlib/win32utils.py'
--- a/bzrlib/win32utils.py	2008-10-01 05:40:45 +0000
+++ b/bzrlib/win32utils.py	2008-10-21 15:36:44 +0000
@@ -320,6 +320,7 @@
 
 def _ensure_unicode(s):
     if s and type(s) != unicode:
+        from bzrlib import osutils
         s = s.decode(osutils.get_user_encoding())
     return s
 




More information about the bazaar-commits mailing list