--- ./Makefile.pre.in.orig 2010-09-04 00:14:52.000000000 +0200
+++ ./Makefile.pre.in 2010-09-08 17:49:53.282521787 +0200
@@ -106,8 +106,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
@@ -121,6 +121,8 @@
EXE= @EXEEXT@
BUILDEXE= @BUILDEXEEXT@
+DEBUG_EXT= @DEBUG_EXT@
+
# Short name and location for Mac OS X Python framework
UNIVERSALSDK=@UNIVERSALSDK@
PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
@@ -444,7 +446,7 @@
$(AR) $(ARFLAGS) $@ $(MODOBJS)
$(RANLIB) $@
-libpython$(VERSION).so: $(LIBRARY_OBJS)
+libpython$(VERSION)$(DEBUG_EXT).so: $(LIBRARY_OBJS)
if test $(INSTSONAME) != $(LDLIBRARY); then \
$(LDSHARED) $(PY_LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
$(LN) -f $(INSTSONAME) $@; \
@@ -997,8 +999,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)
# pkgconfig directory
LIBPC= $(LIBDIR)/pkgconfig
--- ./Python/sysmodule.c.orig 2010-09-01 20:54:56.000000000 +0200
+++ ./Python/sysmodule.c 2010-09-08 17:49:53.286521738 +0200
@@ -1587,6 +1587,12 @@
PyUnicode_FromString("legacy"));
#endif
+#ifdef Py_DEBUG
+ PyDict_SetItemString(sysdict, "pydebug", Py_True);
+#else
+ PyDict_SetItemString(sysdict, "pydebug", Py_False);
+#endif
+
#undef SET_SYS_FROM_STRING
if (PyErr_Occurred())
return NULL;
--- ./Misc/python-config.in.orig 2010-04-06 23:30:42.000000000 +0200
+++ ./Misc/python-config.in 2010-09-08 17:49:53.282521787 +0200
@@ -45,7 +45,7 @@
elif opt in ('--libs', '--ldflags'):
libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
- libs.append('-lpython'+pyver)
+ libs.append('-lpython' + pyver + (sys.pydebug and "_d" or ""))
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
# shared library in prefix/lib/.
if opt == '--ldflags':
--- ./Lib/distutils/command/build.py.orig 2010-07-22 14:50:05.000000000 +0200
+++ ./Lib/distutils/command/build.py 2010-09-08 17:49:53.282521799 +0200
@@ -92,7 +92,8 @@
# 'lib.' 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' + plat_specifier)
if self.build_platlib is None:
self.build_platlib = os.path.join(self.build_base,
'lib' + plat_specifier)
--- ./Lib/sysconfig.py.orig 2010-09-08 17:45:55.000000000 +0200
+++ ./Lib/sysconfig.py 2010-09-08 17:49:53.282521799 +0200
@@ -9,14 +9,16 @@
'get_path_names', 'get_paths', 'get_path', 'get_config_vars',
'get_config_var', 'get_platform', 'get_python_version']
+h_ext = sys.pydebug and '_d' or ''
+
_INSTALL_SCHEMES = {
'posix_prefix': {
'stdlib': '{base}/lib/python{py_version_short}',
'platstdlib': '{platbase}/lib/python{py_version_short}',
'purelib': '{base}/lib/python{py_version_short}/site-packages',
'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
- 'include': '{base}/include/python{py_version_short}',
- 'platinclude': '{platbase}/include/python{py_version_short}',
+ 'include': '{base}/include/python{py_version_short}'+h_ext,
+ 'platinclude': '{platbase}/include/python{py_version_short}'+h_ext,
'scripts': '{base}/bin',
'data': '{base}',
},
@@ -25,8 +27,8 @@
'platstdlib': '{platbase}/local/lib/python{py_version_short}',
'purelib': '{base}/local/lib/python{py_version_short}/dist-packages',
'platlib': '{platbase}/local/lib/python{py_version_short}/dist-packages',
- 'include': '{base}/local/include/python{py_version_short}',
- 'platinclude': '{platbase}/local/include/python{py_version_short}',
+ 'include': '{base}/local/include/python{py_version_short}'+h_ext,
+ 'platinclude': '{platbase}/local/include/python{py_version_short}'+h_ext,
'scripts': '{base}/local/bin',
'data': '{base}/local',
},
@@ -35,8 +37,8 @@
'platstdlib': '{platbase}/lib/python{py_version_short}',
'purelib': '{base}/lib/python3/dist-packages',
'platlib': '{platbase}/lib/python3/dist-packages',
- 'include': '{base}/include/python{py_version_short}',
- 'platinclude': '{platbase}/include/python{py_version_short}',
+ 'include': '{base}/include/python{py_version_short}'+h_ext,
+ 'platinclude': '{platbase}/include/python{py_version_short}'+h_ext,
'scripts': '{base}/bin',
'data': '{base}',
},
@@ -314,7 +316,9 @@
def _get_makefile_filename():
if _PYTHON_BUILD:
return os.path.join(_PROJECT_BASE, "Makefile")
- return os.path.join(get_path('stdlib'), "config", "Makefile")
+ return os.path.join(get_path('stdlib'),
+ "config"+ (sys.pydebug and '_d' or ''),
+ "Makefile")
def _init_posix(vars):
--- ./configure.in.orig 2010-09-08 17:45:55.000000000 +0200
+++ ./configure.in 2010-09-08 18:25:18.226521786 +0200
@@ -578,7 +578,7 @@
AC_MSG_CHECKING(LIBRARY)
if test -z "$LIBRARY"
then
- LIBRARY='libpython$(VERSION).a'
+ LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a'
fi
AC_MSG_RESULT($LIBRARY)
@@ -727,8 +727,8 @@
INSTSONAME="$LDLIBRARY".$SOVERSION
;;
Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
- LDLIBRARY='libpython$(VERSION).so'
- BLDLIBRARY='-L. -lpython$(VERSION)'
+ LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so'
+ BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
case $ac_sys_system in
FreeBSD*)
@@ -830,6 +830,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?
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -83,7 +83,7 @@
else:
incdir = os.path.join(get_config_var('srcdir'), 'Include')
return os.path.normpath(incdir)
- return os.path.join(prefix, "include", "python" + get_python_version())
+ return os.path.join(prefix, "include", "python" + get_python_version() + (sys.pydebug and "_d" or ""))
elif os.name == "nt":
return os.path.join(prefix, "include")
elif os.name == "mac":
@@ -225,7 +225,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):