Rev 3724: Merge John's win32 fixes. in http://people.ubuntu.com/~robertc/baz2.0/integration
Robert Collins
robertc at robertcollins.net
Fri Sep 26 04:53:01 BST 2008
At http://people.ubuntu.com/~robertc/baz2.0/integration
------------------------------------------------------------
revno: 3724
revision-id: robertc at robertcollins.net-20080926035256-a3r8k5sk3ux79ks9
parent: robertc at robertcollins.net-20080926034034-sdauunxwk15kv513
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Fri 2008-09-26 13:52:56 +1000
message:
Merge John's win32 fixes.
removed:
bzrlib/_walkdirs_win32.h _walkdirs_win32.h-20080716220454-kweh3tgxez5dvw2l-1
modified:
bzrlib/_dirstate_helpers_c.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
bzrlib/_walkdirs_win32.pyx _walkdirs_win32.pyx-20080716220454-kweh3tgxez5dvw2l-2
bzrlib/python-compat.h pythoncompat.h-20080924041409-9kvi0fgtuuqp743j-1
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
=== modified file 'bzrlib/_dirstate_helpers_c.pyx'
--- a/bzrlib/_dirstate_helpers_c.pyx 2008-09-25 02:01:39 +0000
+++ b/bzrlib/_dirstate_helpers_c.pyx 2008-09-26 03:52:56 +0000
@@ -39,9 +39,9 @@
cdef int ERROR_DIRECTORY
ERROR_DIRECTORY = 267
-#python2.4 support
+#python2.4 support, and other platform-dependent includes
cdef extern from "python-compat.h":
- pass
+ unsigned long htonl(unsigned long)
# 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
@@ -57,10 +57,6 @@
ctypedef int intptr_t
-cdef extern from "arpa/inet.h":
- unsigned long htonl(unsigned long)
-
-
cdef extern from "stdlib.h":
unsigned long int strtoul(char *nptr, char **endptr, int base)
@@ -68,6 +64,7 @@
cdef extern from 'sys/stat.h':
int S_ISDIR(int mode)
int S_ISREG(int mode)
+ # On win32, this actually comes from "python-compat.h"
int S_ISLNK(int mode)
int S_IXUSR
=== removed file 'bzrlib/_walkdirs_win32.h'
--- a/bzrlib/_walkdirs_win32.h 2008-07-17 03:46:13 +0000
+++ b/bzrlib/_walkdirs_win32.h 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2007 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
- */
-
-/* Header includes, etc for _walkdirs_win32
- * Pyrex doesn't support #define, and defining WIN32_LEAN_AND_MEAN makes
- * importing windows.h a lot less painful.
- */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
=== modified file 'bzrlib/_walkdirs_win32.pyx'
--- a/bzrlib/_walkdirs_win32.pyx 2008-09-23 23:28:27 +0000
+++ b/bzrlib/_walkdirs_win32.pyx 2008-09-26 03:52:56 +0000
@@ -17,7 +17,7 @@
"""Helper functions for Walkdirs on win32."""
-cdef extern from "_walkdirs_win32.h":
+cdef extern from "python-compat.h":
struct _HANDLE:
pass
ctypedef _HANDLE *HANDLE
=== modified file 'bzrlib/python-compat.h'
--- a/bzrlib/python-compat.h 2008-09-24 04:15:03 +0000
+++ b/bzrlib/python-compat.h 2008-09-26 03:52:56 +0000
@@ -33,4 +33,24 @@
#define PyInt_AsSsize_t(o) PyInt_AsLong(o)
#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>
+
+ /* sys/stat.h doesn't have S_ISLNK on win32, so we fake it by just always
+ * returning False
+ */
+ #define S_ISLNK(mode) (0)
+#else /* Not win32 */
+ /* For htonl */
+ #include "arpa/inet.h"
#endif
+
+
+#endif /* _BZR_PYTHON_COMPAT_H */
=== modified file 'setup.py'
--- a/setup.py 2008-09-24 00:09:49 +0000
+++ b/setup.py 2008-09-26 03:52:56 +0000
@@ -226,15 +226,18 @@
add_pyrex_extension('bzrlib._btree_serializer_c')
-add_pyrex_extension('bzrlib._dirstate_helpers_c')
add_pyrex_extension('bzrlib._knit_load_data_c')
if sys.platform == 'win32':
+ add_pyrex_extension('bzrlib._dirstate_helpers_c',
+ libraries=['Ws2_32']
+ )
# pyrex uses the macro WIN32 to detect the platform, even though it should
# be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
# right value.
add_pyrex_extension('bzrlib._walkdirs_win32',
define_macros=[('WIN32', None)])
else:
+ add_pyrex_extension('bzrlib._dirstate_helpers_c')
add_pyrex_extension('bzrlib._readdir_pyx')
ext_modules.append(Extension('bzrlib._patiencediff_c', ['bzrlib/_patiencediff_c.c']))
More information about the bazaar-commits
mailing list