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
|
#! /bin/sh -e
# DP: Change the interpreter to build and install python extensions
# DP: built with the python-dbg interpreter with a different name into
# DP: the same path (by appending `_d' to the extension name).
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p1 < $0
autoconf
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
rm -f configure
;;
*)
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
exit 1
esac
exit 0
--- ./Lib/distutils/command/build.py.orig 2004-11-10 23:23:15.000000000 +0100
+++ ./Lib/distutils/command/build.py 2007-01-26 15:16:50.000000000 +0100
@@ -68,15 +68,16 @@
def finalize_options (self):
plat_specifier = ".%s-%s" % (get_platform(), sys.version[0:3])
-
+ debug_ext = sys.pydebug and '_d' or ''
+
# 'build_purelib' and 'build_platlib' just default to 'lib' and
# 'lib.<plat>' under the base build directory. We only use one of
# them for a given distribution, though --
if self.build_purelib is None:
- self.build_purelib = os.path.join(self.build_base, 'lib')
+ self.build_purelib = os.path.join(self.build_base, 'lib' + debug_ext)
if self.build_platlib is None:
self.build_platlib = os.path.join(self.build_base,
- 'lib' + plat_specifier)
+ 'lib' + debug_ext + plat_specifier)
# 'build_lib' is the actual directory that we will use for this
# particular module distribution -- if user didn't supply it, pick
@@ -91,7 +92,7 @@
# "build/temp.<plat>"
if self.build_temp is None:
self.build_temp = os.path.join(self.build_base,
- 'temp' + plat_specifier)
+ 'temp' + debug_ext + plat_specifier)
if self.build_scripts is None:
self.build_scripts = os.path.join(self.build_base,
'scripts-' + sys.version[0:3])
--- ./Lib/distutils/sysconfig.py.orig 2006-10-08 19:41:25.000000000 +0200
+++ ./Lib/distutils/sysconfig.py 2007-01-26 15:18:43.000000000 +0100
@@ -65,7 +65,8 @@
if not os.path.exists(inc_dir):
inc_dir = os.path.join(os.path.dirname(base), "Include")
return inc_dir
- return os.path.join(prefix, "include", "python" + sys.version[:3])
+ return os.path.join(prefix, "include",
+ "python" + sys.version[:3] + (sys.pydebug and '_d' or ''))
elif os.name == "nt":
return os.path.join(prefix, "include")
elif os.name == "mac":
@@ -202,7 +203,7 @@
if python_build:
return os.path.join(os.path.dirname(sys.executable), "Makefile")
lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
- return os.path.join(lib_dir, "config", "Makefile")
+ return os.path.join(lib_dir, "config" + (sys.pydebug and "_d" or ""), "Makefile")
def parse_config_h(fp, g=None):
--- ./Lib/site.py.orig 2004-07-20 04:28:28.000000000 +0200
+++ ./Lib/site.py 2007-01-26 15:16:50.000000000 +0100
@@ -98,7 +98,7 @@
"""Append ./build/lib.<platform> in case we're running in the build dir
(especially for Guido :-)"""
from distutils.util import get_platform
- s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
+ s = "build/lib%s.%s-%.3s" % (sys.pydebug and '_d' or '', get_platform(), sys.version)
s = os.path.join(os.path.dirname(sys.path[-1]), s)
sys.path.append(s)
--- ./Python/dynload_shlib.c.orig
+++ ./Python/dynload_shlib.c
@@ -46,6 +46,10 @@
{"module.exe", "rb", C_EXTENSION},
{"MODULE.EXE", "rb", C_EXTENSION},
#else
+#ifdef Py_DEBUG
+ {"_d.so", "rb", C_EXTENSION},
+ {"module_d.so", "rb", C_EXTENSION},
+#endif
{".so", "rb", C_EXTENSION},
{"module.so", "rb", C_EXTENSION},
#endif
--- ./configure.in.orig 2006-10-17 18:03:36.000000000 +0200
+++ ./configure.in 2007-01-26 15:16:50.000000000 +0100
@@ -715,6 +715,12 @@
fi],
[AC_MSG_RESULT(no)])
+if test "$Py_DEBUG" = 'true'
+then
+ DEBUG_EXT=_d
+fi
+AC_SUBST(DEBUG_EXT)
+
# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
# merged with this chunk of code?
@@ -1362,7 +1368,7 @@
case $ac_sys_system in
hp*|HP*) SO=.sl;;
CYGWIN*) SO=.dll;;
- *) SO=.so;;
+ *) SO=$DEBUG_EXT.so;;
esac
else
# this might also be a termcap variable, see #610332
--- ./Makefile.pre.in.orig 2006-10-08 19:41:25.000000000 +0200
+++ ./Makefile.pre.in 2007-01-26 15:16:50.000000000 +0100
@@ -88,8 +88,8 @@
# Detailed destination directories
BINLIBDEST= $(LIBDIR)/python$(VERSION)
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
-INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
-CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
+INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)$(DEBUG_EXT)
+CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)$(DEBUG_EXT)
LIBP= $(LIBDIR)/python$(VERSION)
# Symbols used for using shared libraries
@@ -102,6 +102,8 @@
EXE= @EXEEXT@
BUILDEXE= @BUILDEXEEXT@
+DEBUG_EXT= @DEBUG_EXT@
+
# Short name and location for Mac OS X Python framework
UNIVERSALSDK=@UNIVERSALSDK@
PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
@@ -794,8 +796,8 @@
$(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
# Install the library and miscellaneous stuff needed for extending/embedding
-# This goes into $(exec_prefix)
-LIBPL= $(LIBP)/config
+# This goes into $(exec_prefix)$(DEBUG_EXT)
+LIBPL= $(LIBP)/config$(DEBUG_EXT)
libainstall: all
@for i in $(LIBDIR) $(LIBP) $(LIBPL); \
do \
--- ./Python/sysmodule.c.orig 2006-10-05 18:08:58.000000000 +0000
+++ ./Python/sysmodule.c 2007-07-10 17:35:14.000000000 +0000
@@ -1069,6 +1069,11 @@
SET_SYS_FROM_STRING("winver",
PyString_FromString(PyWin_DLLVersionString));
#endif
+#ifdef Py_DEBUG
+ PyDict_SetItemString(sysdict, "pydebug", Py_True);
+#else
+ PyDict_SetItemString(sysdict, "pydebug", Py_False);
+#endif
#undef SET_SYS_FROM_STRING
if (warnoptions == NULL) {
warnoptions = PyList_New(0);
|