1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
|
diff -ru Python-2.5.1/configure.in Python-2.5.1+iPhone/configure.in
--- Python-2.5.1/configure.in 2007-03-12 10:50:51.000000000 +0000
+++ Python-2.5.1+iPhone/configure.in 2008-04-29 10:53:21.000000000 +0000
@@ -165,7 +165,7 @@
AC_MSG_CHECKING(MACHDEP)
if test -z "$MACHDEP"
then
- ac_sys_system=`uname -s`
+ ac_sys_system=Darwin
if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
-o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
ac_sys_release=`uname -v`
@@ -247,6 +247,8 @@
esac
+define_xopen_source=no
+
if test $define_xopen_source = yes
then
# On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
@@ -1420,7 +1422,6 @@
echo '+ Continuing in 10 seconds to let you to ponder. +'
echo '+ +'
echo '====================================================================='
- sleep 10
fi
AC_MSG_RESULT($SO)
AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
@@ -1473,12 +1474,11 @@
Darwin/*)
# Use -undefined dynamic_lookup whenever possible (10.3 and later).
# This allows an extension to be used in any Python
- cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
+ cur_target=10.5
if test ${cur_target} '>' 10.2; then
cur_target=10.3
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
- EXPORT_MACOSX_DEPLOYMENT_TARGET=''
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
then
if test "${enable_universalsdk}"; then
@@ -3367,41 +3368,6 @@
AC_MSG_RESULT(no)
fi
-AC_MSG_CHECKING(for %zd printf() format support)
-AC_TRY_RUN([#include <stdio.h>
-#include <stddef.h>
-#include <string.h>
-
-int main()
-{
- char buffer[256];
-
-#ifdef HAVE_SSIZE_T
-typedef ssize_t Py_ssize_t;
-#elif SIZEOF_VOID_P == SIZEOF_LONG
-typedef long Py_ssize_t;
-#else
-typedef int Py_ssize_t;
-#endif
-
- if(sprintf(buffer, "%zd", (size_t)123) < 0)
- return 1;
-
- if (strcmp(buffer, "123"))
- return 1;
-
- if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
- return 1;
-
- if (strcmp(buffer, "-123"))
- return 1;
-
- return 0;
-}],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
- AC_MSG_RESULT(no))
-
AC_CHECK_TYPE(socklen_t,,
AC_DEFINE(socklen_t,int,
Define to `int' if <sys/socket.h> does not define.),[
diff -ru Python-2.5.1/Include/pyport.h Python-2.5.1+iPhone/Include/pyport.h
--- Python-2.5.1/Include/pyport.h 2006-10-02 15:24:01.000000000 +0000
+++ Python-2.5.1+iPhone/Include/pyport.h 2008-04-29 10:53:21.000000000 +0000
@@ -731,7 +731,7 @@
* rather than waiting for integer multiplication to trigger bogus
* overflows.
*/
-#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
+//#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
#endif
#ifdef __cplusplus
diff -ru Python-2.5.1/Modules/_ctypes/cfield.c Python-2.5.1+iPhone/Modules/_ctypes/cfield.c
--- Python-2.5.1/Modules/_ctypes/cfield.c 2007-03-22 19:43:37.000000000 +0000
+++ Python-2.5.1+iPhone/Modules/_ctypes/cfield.c 2008-04-29 10:53:21.000000000 +0000
@@ -1642,7 +1642,7 @@
struct _ffi_type **elements;
} ffi_type;
*/
-
+#if 0
/* align and size are bogus for void, but they must not be zero */
ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID };
@@ -1664,5 +1664,5 @@
/* ffi_type ffi_type_longdouble */
ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER };
-
+#endif
/*---------------- EOF ----------------*/
diff -ru Python-2.5.1/Modules/getaddrinfo.c Python-2.5.1+iPhone/Modules/getaddrinfo.c
--- Python-2.5.1/Modules/getaddrinfo.c 2003-08-17 21:28:39.000000000 +0000
+++ Python-2.5.1+iPhone/Modules/getaddrinfo.c 2008-04-29 10:53:21.000000000 +0000
@@ -38,7 +38,7 @@
* - PF_UNSPEC case would be handled in getipnodebyname() with the AI_ALL flag.
*/
-#if 0
+#if 1
#include <sys/types.h>
#include <sys/param.h>
#include <sys/sysctl.h>
diff -ru Python-2.5.1/Modules/mmapmodule.c Python-2.5.1+iPhone/Modules/mmapmodule.c
--- Python-2.5.1/Modules/mmapmodule.c 2006-08-22 13:57:07.000000000 +0000
+++ Python-2.5.1+iPhone/Modules/mmapmodule.c 2008-04-29 10:53:21.000000000 +0000
@@ -36,6 +36,7 @@
#ifdef UNIX
#include <sys/mman.h>
#include <sys/stat.h>
+#include <sys/fcntl.h>
#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
static int
diff -ru Python-2.5.1/setup.py Python-2.5.1+iPhone/setup.py
--- Python-2.5.1/setup.py 2007-02-14 12:53:41.000000000 +0000
+++ Python-2.5.1+iPhone/setup.py 2008-04-29 11:05:35.000000000 +0000
@@ -206,46 +206,16 @@
ext_filename = os.path.join(
self.build_lib,
self.get_ext_filename(self.get_ext_fullname(ext.name)))
- try:
- imp.load_dynamic(ext.name, ext_filename)
- except ImportError, why:
- self.announce('*** WARNING: renaming "%s" since importing it'
- ' failed: %s' % (ext.name, why), level=3)
- assert not self.inplace
- basename, tail = os.path.splitext(ext_filename)
- newname = basename + "_failed" + tail
- if os.path.exists(newname):
- os.remove(newname)
- os.rename(ext_filename, newname)
-
- # XXX -- This relies on a Vile HACK in
- # distutils.command.build_ext.build_extension(). The
- # _built_objects attribute is stored there strictly for
- # use here.
- # If there is a failure, _built_objects may not be there,
- # so catch the AttributeError and move on.
- try:
- for filename in self._built_objects:
- os.remove(filename)
- except AttributeError:
- self.announce('unable to remove files (ignored)')
- except:
- exc_type, why, tb = sys.exc_info()
- self.announce('*** WARNING: importing extension "%s" '
- 'failed with %s: %s' % (ext.name, exc_type, why),
- level=3)
def get_platform(self):
- # Get value of sys.platform
- for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
- if sys.platform.startswith(platform):
- return platform
- return sys.platform
+ return 'darwin'
def detect_modules(self):
+ sysroot = os.getenv('PKG_ROOT')
+
# Ensure that /usr/local is always used
- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ add_dir_to_list(self.compiler.library_dirs, sysroot + '/usr/local/lib')
+ add_dir_to_list(self.compiler.include_dirs, sysroot + '/usr/local/include')
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -294,10 +264,10 @@
# if a file is found in one of those directories, it can
# be assumed that no additional -I,-L directives are needed.
lib_dirs = self.compiler.library_dirs + [
- '/lib64', '/usr/lib64',
- '/lib', '/usr/lib',
+ sysroot + '/lib64', sysroot + '/usr/lib64',
+ sysroot + '/lib', sysroot + '/usr/lib',
]
- inc_dirs = self.compiler.include_dirs + ['/usr/include']
+ inc_dirs = self.compiler.include_dirs + [sysroot + '/usr/include']
exts = []
config_h = sysconfig.get_config_h_filename()
@@ -309,9 +279,11 @@
# Check for AtheOS which has libraries in non-standard locations
if platform == 'atheos':
lib_dirs += ['/system/libs', '/atheos/autolnk/lib']
- lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
inc_dirs += ['/system/include', '/atheos/autolnk/include']
- inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
+
+ lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
+ inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
+ inc_dirs += os.getenv('CPATH', '').split(os.pathsep)
# OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
if platform in ['osf1', 'unixware7', 'openunix8']:
@@ -476,7 +447,7 @@
if find_file('readline/rlconf.h', inc_dirs, []) is None:
do_readline = False
if do_readline:
- if sys.platform == 'darwin':
+ if self.get_platform() == 'darwin':
# In every directory on the search path search for a dynamic
# library and then a static library, instead of first looking
# for dynamic libraries on the entiry path.
@@ -496,11 +467,11 @@
elif self.compiler.find_library_file(lib_dirs, 'curses'):
readline_libs.append('curses')
elif self.compiler.find_library_file(lib_dirs +
- ['/usr/lib/termcap'],
+ [sysroot + '/usr/lib/termcap'],
'termcap'):
readline_libs.append('termcap')
exts.append( Extension('readline', ['readline.c'],
- library_dirs=['/usr/lib/termcap'],
+ library_dirs=[sysroot + '/usr/lib/termcap'],
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
if platform not in ['mac']:
@@ -520,20 +491,20 @@
depends = ['socketmodule.h']) )
# Detect SSL support for the socket module (via _ssl)
search_for_ssl_incs_in = [
- '/usr/local/ssl/include',
- '/usr/contrib/ssl/include/'
+ sysroot + '/usr/local/ssl/include',
+ sysroot + '/usr/contrib/ssl/include/'
]
ssl_incs = find_file('openssl/ssl.h', inc_dirs,
search_for_ssl_incs_in
)
if ssl_incs is not None:
krb5_h = find_file('krb5.h', inc_dirs,
- ['/usr/kerberos/include'])
+ [sysroot + '/usr/kerberos/include'])
if krb5_h:
ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
- ['/usr/local/ssl/lib',
- '/usr/contrib/ssl/lib/'
+ [sysroot + '/usr/local/ssl/lib',
+ sysroot + '/usr/contrib/ssl/lib/'
] )
if (ssl_incs is not None and
@@ -612,31 +583,25 @@
# construct a list of paths to look for the header file in on
# top of the normal inc_dirs.
- db_inc_paths = [
- '/usr/include/db4',
- '/usr/local/include/db4',
- '/opt/sfw/include/db4',
- '/sw/include/db4',
- '/usr/include/db3',
- '/usr/local/include/db3',
- '/opt/sfw/include/db3',
- '/sw/include/db3',
- ]
+ db_inc_paths = []
+ # major number specific paths
+ for x in (3,4):
+ db_inc_paths += map(lambda i: i + '/db%d' % x, inc_dirs)
# 4.x minor number specific paths
for x in (0,1,2,3,4,5):
- db_inc_paths.append('/usr/include/db4%d' % x)
- db_inc_paths.append('/usr/include/db4.%d' % x)
- db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
- db_inc_paths.append('/usr/local/include/db4%d' % x)
- db_inc_paths.append('/pkg/db-4.%d/include' % x)
- db_inc_paths.append('/opt/db-4.%d/include' % x)
+ db_inc_paths += map(lambda i: i + '/db%d' % x, inc_dirs)
+ db_inc_paths += map(lambda i: i + '/db.%d' % x, inc_dirs)
+ db_inc_paths.append(sysroot + '/usr/local/BerkeleyDB.4.%d/include' % x)
+ db_inc_paths.append(sysroot + '/usr/local/include/db4%d' % x)
+ db_inc_paths.append(sysroot + '/pkg/db-4.%d/include' % x)
+ db_inc_paths.append(sysroot + '/opt/db-4.%d/include' % x)
# 3.x minor number specific paths
for x in (3,):
- db_inc_paths.append('/usr/include/db3%d' % x)
- db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
- db_inc_paths.append('/usr/local/include/db3%d' % x)
- db_inc_paths.append('/pkg/db-3.%d/include' % x)
- db_inc_paths.append('/opt/db-3.%d/include' % x)
+ db_inc_paths += map(lambda i: i + '/db3%d' % x, inc_dirs)
+ db_inc_paths.append(sysroot + '/usr/local/BerkeleyDB.3.%d/include' % x)
+ db_inc_paths.append(sysroot + '/usr/local/include/db3%d' % x)
+ db_inc_paths.append(sysroot + '/pkg/db-3.%d/include' % x)
+ db_inc_paths.append(sysroot + '/opt/db-3.%d/include' % x)
# Add some common subdirectories for Sleepycat DB to the list,
# based on the standard include directories. This way DB3/4 gets
@@ -746,13 +711,9 @@
# We hunt for #define SQLITE_VERSION "n.n.n"
# We need to find >= sqlite version 3.0.8
sqlite_incdir = sqlite_libdir = None
- sqlite_inc_paths = [ '/usr/include',
- '/usr/include/sqlite',
- '/usr/include/sqlite3',
- '/usr/local/include',
- '/usr/local/include/sqlite',
- '/usr/local/include/sqlite3',
- ]
+ sqlite_inc_paths = inc_dirs
+ sqlite_inc_paths += map(lambda i: i + '/sqlite', inc_dirs)
+ sqlite_inc_paths += map(lambda i: i + '/sqlite3', inc_dirs)
MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
MIN_SQLITE_VERSION = ".".join([str(x)
for x in MIN_SQLITE_VERSION_NUMBER])
@@ -806,13 +767,13 @@
'_sqlite/util.c', ]
sqlite_defines = []
- if sys.platform != "win32":
+ if self.get_platform() != "win32":
sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
else:
sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
- if sys.platform == 'darwin':
+ if self.get_platform() == 'darwin':
# In every directory on the search path search for a dynamic
# library and then a static library, instead of first looking
# for dynamic libraries on the entiry path.
@@ -837,7 +798,7 @@
# accidentally building this module with a later version of the
# underlying db library. May BSD-ish Unixes incorporate db 1.85
# symbols into libc and place the include file in /usr/include.
- f = "/usr/include/db.h"
+ f = sysroot + "/usr/include/db.h"
if os.path.exists(f):
data = open(f).read()
m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
@@ -962,7 +923,7 @@
break
if version >= version_req:
if (self.compiler.find_library_file(lib_dirs, 'z')):
- if sys.platform == "darwin":
+ if self.get_platform() == "darwin":
zlib_extra_link_args = ('-Wl,-search_paths_first',)
else:
zlib_extra_link_args = ()
@@ -972,7 +933,7 @@
# Gustavo Niemeyer's bz2 module.
if (self.compiler.find_library_file(lib_dirs, 'bz2')):
- if sys.platform == "darwin":
+ if self.get_platform() == "darwin":
bz2_extra_link_args = ('-Wl,-search_paths_first',)
else:
bz2_extra_link_args = ()
@@ -1175,7 +1136,7 @@
# For 8.4a2, the X11 headers are not included. Rather than include a
# complicated search, this is a hard-coded path. It could bail out
# if X11 libs are not found...
- include_dirs.append('/usr/X11R6/include')
+ include_dirs.append(sysroot + '/usr/X11R6/include')
frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
@@ -1217,7 +1178,7 @@
# Check for the include files on Debian and {Free,Open}BSD, where
# they're put in /usr/include/{tcl,tk}X.Y
dotversion = version
- if '.' not in dotversion and "bsd" in sys.platform.lower():
+ if '.' not in dotversion and "bsd" in self.get_platform().lower():
# OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a,
# but the include subdirs are named like .../include/tcl8.3.
dotversion = dotversion[:-1] + '.' + dotversion[-1]
@@ -1244,19 +1205,19 @@
# Check for various platform-specific directories
if platform == 'sunos5':
- include_dirs.append('/usr/openwin/include')
- added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
+ include_dirs.append(sysroot + '/usr/openwin/include')
+ added_lib_dirs.append(sysroot + '/usr/openwin/lib')
+ elif os.path.exists(sysroot + '/usr/X11R6/include'):
+ include_dirs.append(sysroot + '/usr/X11R6/include')
+ added_lib_dirs.append(sysroot + '/usr/X11R6/lib64')
+ added_lib_dirs.append(sysroot + '/usr/X11R6/lib')
+ elif os.path.exists(sysroot + '/usr/X11R5/include'):
+ include_dirs.append(sysroot + '/usr/X11R5/include')
+ added_lib_dirs.append(sysroot + '/usr/X11R5/lib')
else:
# Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
+ include_dirs.append(sysroot + '/usr/X11/include')
+ added_lib_dirs.append(sysroot + '/usr/X11/lib')
# If Cygwin, then verify that X is installed before proceeding
if platform == 'cygwin':
@@ -1363,13 +1324,13 @@
'_ctypes/malloc_closure.c']
depends = ['_ctypes/ctypes.h']
- if sys.platform == 'darwin':
+ if self.get_platform() == 'darwin':
sources.append('_ctypes/darwin/dlfcn_simple.c')
include_dirs.append('_ctypes/darwin')
# XXX Is this still needed?
## extra_link_args.extend(['-read_only_relocs', 'warning'])
- elif sys.platform == 'sunos5':
+ elif self.get_platform() == 'sunos5':
# XXX This shouldn't be necessary; it appears that some
# of the assembler code is non-PIC (i.e. it has relocations
# when it shouldn't. The proper fix would be to rewrite
|