3
# DP: Change the interpreter to build and install python extensions
4
# DP: built with the python-dbg interpreter with a different name into
5
# DP: the same path (by appending `_d' to the extension name).
8
if [ $# -eq 3 -a "$2" = '-d' ]; then
11
elif [ $# -ne 1 ]; then
12
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
17
patch $pdir -f --no-backup-if-mismatch -p1 < $0
21
patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
25
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
30
--- ./Python/sysmodule.c.orig 2009-05-28 11:24:38.000000000 +0200
31
+++ ./Python/sysmodule.c 2009-06-21 22:52:05.000000000 +0200
32
@@ -1436,6 +1436,12 @@
33
PyUnicode_FromString("legacy"));
37
+ PyDict_SetItemString(sysdict, "pydebug", Py_True);
39
+ PyDict_SetItemString(sysdict, "pydebug", Py_False);
42
#undef SET_SYS_FROM_STRING
45
--- ./Python/dynload_shlib.c.orig 2008-06-14 08:18:10.000000000 +0200
46
+++ ./Python/dynload_shlib.c 2009-06-21 22:52:05.000000000 +0200
48
{"module.exe", "rb", C_EXTENSION},
49
{"MODULE.EXE", "rb", C_EXTENSION},
52
+ {"_d.so", "rb", C_EXTENSION},
53
+ {"module_d.so", "rb", C_EXTENSION},
55
{".so", "rb", C_EXTENSION},
56
{"module.so", "rb", C_EXTENSION},
58
--- ./Lib/distutils/command/build.py.orig 2008-05-29 15:43:16.000000000 +0200
59
+++ ./Lib/distutils/command/build.py 2009-06-21 22:52:05.000000000 +0200
61
# 'lib.<plat>' under the base build directory. We only use one of
62
# them for a given distribution, though --
63
if self.build_purelib is None:
64
- self.build_purelib = os.path.join(self.build_base, 'lib')
65
+ self.build_purelib = os.path.join(self.build_base,
66
+ 'lib' + plat_specifier)
67
if self.build_platlib is None:
68
self.build_platlib = os.path.join(self.build_base,
69
'lib' + plat_specifier)
70
--- ./Lib/distutils/sysconfig.py.orig 2009-06-21 22:50:28.000000000 +0200
71
+++ ./Lib/distutils/sysconfig.py 2009-06-21 22:52:05.000000000 +0200
74
incdir = os.path.join(get_config_var('srcdir'), 'Include')
75
return os.path.normpath(incdir)
76
- return os.path.join(prefix, "include", "python" + get_python_version())
77
+ return os.path.join(prefix, "include",
78
+ "python" + get_python_version() + (sys.pydebug and '_d' or ''))
80
return os.path.join(prefix, "include")
81
elif os.name == "mac":
84
return os.path.join(os.path.dirname(sys.executable), "Makefile")
85
lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
86
- return os.path.join(lib_dir, "config", "Makefile")
87
+ return os.path.join(lib_dir, "config" + (sys.pydebug and "_d" or ""), "Makefile")
90
def parse_config_h(fp, g=None):
91
--- ./Makefile.pre.in.orig 2009-06-14 19:29:12.000000000 +0200
92
+++ ./Makefile.pre.in 2009-06-21 22:53:14.000000000 +0200
94
# Detailed destination directories
95
BINLIBDEST= $(LIBDIR)/python$(VERSION)
96
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
97
-INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
98
-CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
99
+INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)$(DEBUG_EXT)
100
+CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)$(DEBUG_EXT)
101
LIBP= $(LIBDIR)/python$(VERSION)
103
# Symbols used for using shared libraries
106
BUILDEXE= @BUILDEXEEXT@
108
+DEBUG_EXT= @DEBUG_EXT@
110
# Short name and location for Mac OS X Python framework
111
UNIVERSALSDK=@UNIVERSALSDK@
112
PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
114
$(AR) $(ARFLAGS) $@ $(MODOBJS)
117
-libpython$(VERSION).so: $(LIBRARY_OBJS)
118
+libpython$(VERSION)$(DEBUG_EXT).so: $(LIBRARY_OBJS)
119
if test $(INSTSONAME) != $(LDLIBRARY); then \
120
$(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
121
$(LN) -f $(INSTSONAME) $@; \
123
$(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
125
# Install the library and miscellaneous stuff needed for extending/embedding
126
-# This goes into $(exec_prefix)
127
-LIBPL= $(LIBP)/config
128
+# This goes into $(exec_prefix)$(DEBUG_EXT)
129
+LIBPL= $(LIBP)/config$(DEBUG_EXT)
131
# pkgconfig directory
132
LIBPC= $(LIBDIR)/pkgconfig
133
--- ./configure.in.orig 2009-06-21 22:50:28.000000000 +0200
134
+++ ./configure.in 2009-06-21 22:52:05.000000000 +0200
136
AC_MSG_CHECKING(LIBRARY)
137
if test -z "$LIBRARY"
139
- LIBRARY='libpython$(VERSION).a'
140
+ LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a'
142
AC_MSG_RESULT($LIBRARY)
145
INSTSONAME="$LDLIBRARY".$SOVERSION
147
Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
148
- LDLIBRARY='libpython$(VERSION).so'
149
- BLDLIBRARY='-L. -lpython$(VERSION)'
150
+ LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so'
151
+ BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)'
152
RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
153
case $ac_sys_system in
159
+if test "$Py_DEBUG" = 'true'
165
# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
166
# merged with this chunk of code?
168
@@ -1563,7 +1569,7 @@
173
+ *) SO=$DEBUG_EXT.so;;
176
# this might also be a termcap variable, see #610332
177
--- ./Misc/python-config.in.orig 2008-05-29 15:42:59.000000000 +0200
178
+++ ./Misc/python-config.in 2009-06-21 22:52:05.000000000 +0200
181
elif opt in ('--libs', '--ldflags'):
182
libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
183
- libs.append('-lpython'+pyver)
184
+ libs.append('-lpython' + pyver + (sys.pydebug and "_d" or ""))
185
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
186
# shared library in prefix/lib/.
187
if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'):