2017-01-11 19:20:31 +00:00
|
|
|
From 898f93aa206e577dfe854c59bc62d0cea09cd5ed Mon Sep 17 00:00:00 2001
|
|
|
|
From: Tomas Orsava <torsava@redhat.com>
|
|
|
|
Date: Tue, 10 Jan 2017 16:19:50 +0100
|
|
|
|
Subject: [PATCH] Patch to support building both optimized vs debug stacks DSO
|
|
|
|
ABIs,
|
|
|
|
|
|
|
|
sharing the same .py and .pyc files, using "_d.so" to signify a debug build of
|
|
|
|
an extension module.
|
|
|
|
---
|
|
|
|
Lib/distutils/command/build_ext.py | 7 ++++-
|
|
|
|
Lib/distutils/sysconfig.py | 5 ++--
|
|
|
|
Lib/distutils/tests/test_install.py | 3 +-
|
|
|
|
Makefile.pre.in | 56 ++++++++++++++++++++-----------------
|
|
|
|
Misc/python-config.in | 2 +-
|
|
|
|
Modules/makesetup | 2 +-
|
|
|
|
Python/dynload_shlib.c | 11 ++++++--
|
|
|
|
Python/sysmodule.c | 6 ++++
|
|
|
|
configure.ac | 14 ++++++++--
|
|
|
|
9 files changed, 69 insertions(+), 37 deletions(-)
|
|
|
|
|
2016-07-17 20:28:26 +00:00
|
|
|
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
|
2017-01-11 19:20:31 +00:00
|
|
|
index 2c68be3..029d144 100644
|
2016-07-17 20:28:26 +00:00
|
|
|
--- a/Lib/distutils/command/build_ext.py
|
|
|
|
+++ b/Lib/distutils/command/build_ext.py
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -677,7 +677,10 @@ class build_ext (Command):
|
2010-05-20 19:16:46 +00:00
|
|
|
so_ext = get_config_var('SO')
|
|
|
|
if os.name == 'nt' and self.debug:
|
2010-07-21 20:48:17 +00:00
|
|
|
return os.path.join(*ext_path) + '_d' + so_ext
|
2010-05-20 19:16:46 +00:00
|
|
|
- return os.path.join(*ext_path) + so_ext
|
2016-07-17 20:28:26 +00:00
|
|
|
+
|
2010-05-20 19:16:46 +00:00
|
|
|
+ # Similarly, extensions in debug mode are named 'module_d.so', to
|
|
|
|
+ # avoid adding the _d to the SO config variable:
|
|
|
|
+ return os.path.join(*ext_path) + (sys.pydebug and "_d" or "") + so_ext
|
|
|
|
|
|
|
|
def get_export_symbols (self, ext):
|
|
|
|
"""Return the list of symbols that a shared extension has to
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -762,6 +765,8 @@ class build_ext (Command):
|
2010-05-20 19:16:46 +00:00
|
|
|
template = "python%d.%d"
|
|
|
|
pythonlib = (template %
|
|
|
|
(sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
|
|
|
|
+ if sys.pydebug:
|
|
|
|
+ pythonlib += '_d'
|
|
|
|
return ext.libraries + [pythonlib]
|
|
|
|
else:
|
|
|
|
return ext.libraries
|
2016-07-17 20:28:26 +00:00
|
|
|
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
|
2017-01-11 19:20:31 +00:00
|
|
|
index 3e7f077..ec5d584 100644
|
2016-07-17 20:28:26 +00:00
|
|
|
--- a/Lib/distutils/sysconfig.py
|
|
|
|
+++ b/Lib/distutils/sysconfig.py
|
|
|
|
@@ -90,7 +90,8 @@ def get_python_inc(plat_specific=0, prefix=None):
|
2010-07-21 20:48:17 +00:00
|
|
|
# Include is located in the srcdir
|
|
|
|
inc_dir = os.path.join(srcdir, "Include")
|
2010-05-20 19:16:46 +00:00
|
|
|
return inc_dir
|
|
|
|
- return os.path.join(prefix, "include", "python" + get_python_version())
|
|
|
|
+ return os.path.join(prefix, "include",
|
2016-07-17 20:28:26 +00:00
|
|
|
+ "python" + get_python_version() + (sys.pydebug and '-debug' or ''))
|
2010-05-20 19:16:46 +00:00
|
|
|
elif os.name == "nt":
|
|
|
|
return os.path.join(prefix, "include")
|
2010-07-21 20:48:17 +00:00
|
|
|
elif os.name == "os2":
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -248,7 +249,7 @@ def get_makefile_filename():
|
2010-05-20 19:16:46 +00:00
|
|
|
if python_build:
|
Updated to Python 2.7.4.
- Refreshed patches: 0 (config), 7 (sqlite encoding), 16 (rpath in config),
55 (systemtap), 111 (no static lib), 112 (debug build), 113 (more
configuration flags), 130 (add extension to python config), 134 (fix
COUNT_ALLOCS in test_sys), 146 (haslib FIPS), 147 (add debug malloc stats),
153 (fix gdb test noise), 157 (uid, gid overflow - fixed upstream, just
keeping few more downstream tests), 165 (crypt module salt backport),
175 (fix configure Wformat), 5000 (regenerated autotooling patch)
- Dropped patches: 101 (lib64 regex; merged upstream), 171 (exception on
missing /dev/urandom; merged upstream), 172 (poll for multiprocessing socket
connection; merged upstream)
2013-04-09 08:54:58 +00:00
|
|
|
return os.path.join(project_base, "Makefile")
|
2010-05-20 19:16:46 +00:00
|
|
|
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 "-debug" or ""), "Makefile")
|
|
|
|
|
|
|
|
|
|
|
|
def parse_config_h(fp, g=None):
|
2016-07-17 20:28:26 +00:00
|
|
|
diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
|
|
|
|
index 78fac46..d1d0931 100644
|
|
|
|
--- a/Lib/distutils/tests/test_install.py
|
|
|
|
+++ b/Lib/distutils/tests/test_install.py
|
2012-04-13 14:36:12 +00:00
|
|
|
@@ -20,8 +20,9 @@ from distutils.tests import support
|
|
|
|
|
|
|
|
|
|
|
|
def _make_ext_name(modname):
|
|
|
|
- if os.name == 'nt' and sys.executable.endswith('_d.exe'):
|
|
|
|
+ if sys.pydebug:
|
|
|
|
modname += '_d'
|
2016-07-17 20:28:26 +00:00
|
|
|
+
|
2012-04-13 14:36:12 +00:00
|
|
|
return modname + sysconfig.get_config_var('SO')
|
|
|
|
|
|
|
|
|
2016-07-17 20:28:26 +00:00
|
|
|
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
2017-01-11 19:20:31 +00:00
|
|
|
index 997a2fc..467e782 100644
|
2016-07-17 20:28:26 +00:00
|
|
|
--- a/Makefile.pre.in
|
|
|
|
+++ b/Makefile.pre.in
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -116,8 +116,8 @@ SCRIPTDIR= $(prefix)/lib64
|
2010-05-20 19:16:46 +00:00
|
|
|
# Detailed destination directories
|
|
|
|
BINLIBDEST= $(LIBDIR)/python$(VERSION)
|
|
|
|
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
|
|
|
|
-INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
|
|
|
|
-CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
|
|
|
|
+INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX)
|
|
|
|
+CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX)
|
|
|
|
LIBP= $(LIBDIR)/python$(VERSION)
|
|
|
|
|
|
|
|
# Symbols used for using shared libraries
|
2016-07-17 20:28:26 +00:00
|
|
|
@@ -131,6 +131,12 @@ DESTSHARED= $(BINLIBDEST)/lib-dynload
|
2010-05-20 19:16:46 +00:00
|
|
|
EXE= @EXEEXT@
|
|
|
|
BUILDEXE= @BUILDEXEEXT@
|
|
|
|
|
|
|
|
+# DEBUG_EXT is used by ELF files (names and SONAMEs); it will be "_d" for a debug build
|
|
|
|
+# DEBUG_SUFFIX is used by filesystem paths; it will be "-debug" for a debug build
|
|
|
|
+# Both will be empty in an optimized build
|
|
|
|
+DEBUG_EXT= @DEBUG_EXT@
|
|
|
|
+DEBUG_SUFFIX= @DEBUG_SUFFIX@
|
|
|
|
+
|
|
|
|
# Short name and location for Mac OS X Python framework
|
|
|
|
UNIVERSALSDK=@UNIVERSALSDK@
|
|
|
|
PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
|
2016-07-17 20:28:26 +00:00
|
|
|
@@ -197,8 +203,8 @@ LIBOBJDIR= Python/
|
2010-05-20 19:16:46 +00:00
|
|
|
LIBOBJS= @LIBOBJS@
|
|
|
|
UNICODE_OBJS= @UNICODE_OBJS@
|
|
|
|
|
|
|
|
-PYTHON= python$(EXE)
|
|
|
|
-BUILDPYTHON= python$(BUILDEXE)
|
|
|
|
+PYTHON= python$(DEBUG_SUFFIX)$(EXE)
|
|
|
|
+BUILDPYTHON= python$(DEBUG_SUFFIX)$(BUILDEXE)
|
|
|
|
|
Updated to Python 2.7.4.
- Refreshed patches: 0 (config), 7 (sqlite encoding), 16 (rpath in config),
55 (systemtap), 111 (no static lib), 112 (debug build), 113 (more
configuration flags), 130 (add extension to python config), 134 (fix
COUNT_ALLOCS in test_sys), 146 (haslib FIPS), 147 (add debug malloc stats),
153 (fix gdb test noise), 157 (uid, gid overflow - fixed upstream, just
keeping few more downstream tests), 165 (crypt module salt backport),
175 (fix configure Wformat), 5000 (regenerated autotooling patch)
- Dropped patches: 101 (lib64 regex; merged upstream), 171 (exception on
missing /dev/urandom; merged upstream), 172 (poll for multiprocessing socket
connection; merged upstream)
2013-04-09 08:54:58 +00:00
|
|
|
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
|
2017-01-11 19:20:31 +00:00
|
|
|
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
|
|
|
|
@@ -547,7 +553,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
|
2014-01-29 13:20:07 +00:00
|
|
|
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
|
Updated to Python 2.7.4.
- Refreshed patches: 0 (config), 7 (sqlite encoding), 16 (rpath in config),
55 (systemtap), 111 (no static lib), 112 (debug build), 113 (more
configuration flags), 130 (add extension to python config), 134 (fix
COUNT_ALLOCS in test_sys), 146 (haslib FIPS), 147 (add debug malloc stats),
153 (fix gdb test noise), 157 (uid, gid overflow - fixed upstream, just
keeping few more downstream tests), 165 (crypt module salt backport),
175 (fix configure Wformat), 5000 (regenerated autotooling patch)
- Dropped patches: 101 (lib64 regex; merged upstream), 171 (exception on
missing /dev/urandom; merged upstream), 172 (poll for multiprocessing socket
connection; merged upstream)
2013-04-09 08:54:58 +00:00
|
|
|
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
|
2010-05-20 19:16:46 +00:00
|
|
|
|
|
|
|
-libpython$(VERSION).so: $(LIBRARY_OBJS)
|
|
|
|
+libpython$(VERSION)$(DEBUG_EXT).so: $(LIBRARY_OBJS)
|
|
|
|
if test $(INSTSONAME) != $(LDLIBRARY); then \
|
2012-04-13 14:36:12 +00:00
|
|
|
$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
2010-05-20 19:16:46 +00:00
|
|
|
$(LN) -f $(INSTSONAME) $@; \
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -954,18 +960,18 @@ bininstall: altbininstall
|
2012-04-19 00:19:10 +00:00
|
|
|
then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
|
|
|
|
else true; \
|
2010-05-20 19:16:46 +00:00
|
|
|
fi
|
2012-04-19 00:19:10 +00:00
|
|
|
- (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))
|
|
|
|
- -rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)
|
2012-04-13 14:36:12 +00:00
|
|
|
- (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))
|
2012-04-19 00:19:10 +00:00
|
|
|
- -rm -f $(DESTDIR)$(BINDIR)/python2-config
|
2012-04-13 14:36:12 +00:00
|
|
|
- (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python2-config)
|
|
|
|
- -rm -f $(DESTDIR)$(BINDIR)/python-config
|
2012-04-19 00:19:10 +00:00
|
|
|
- (cd $(DESTDIR)$(BINDIR); $(LN) -s python2-config python-config)
|
|
|
|
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(DEBUG_SUFFIX)$(EXE) $(PYTHON))
|
|
|
|
+ -rm -f $(DESTDIR)$(BINDIR)/python2$(DEBUG_SUFFIX)$(EXE)
|
|
|
|
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(DEBUG_SUFFIX)$(EXE) python2$(DEBUG_SUFFIX)$(EXE))
|
|
|
|
+ -rm -f $(DESTDIR)$(BINDIR)/python2$(DEBUG_SUFFIX)-config
|
|
|
|
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(DEBUG_SUFFIX)-config python2$(DEBUG_SUFFIX)-config)
|
|
|
|
+ -rm -f $(DESTDIR)$(BINDIR)/python$(DEBUG_SUFFIX)-config
|
|
|
|
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(DEBUG_SUFFIX)-config python$(DEBUG_SUFFIX)-config)
|
2010-07-21 20:48:17 +00:00
|
|
|
-test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)
|
2012-04-19 00:19:10 +00:00
|
|
|
- -rm -f $(DESTDIR)$(LIBPC)/python2.pc
|
|
|
|
- (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc)
|
|
|
|
- -rm -f $(DESTDIR)$(LIBPC)/python.pc
|
|
|
|
- (cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc)
|
|
|
|
+ -rm -f $(DESTDIR)$(LIBPC)/python2$(DEBUG_SUFFIX).pc
|
|
|
|
+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)$(DEBUG_SUFFIX).pc python2$(DEBUG_SUFFIX).pc)
|
|
|
|
+ -rm -f $(DESTDIR)$(LIBPC)/python$(DEBUG_SUFFIX).pc
|
|
|
|
+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python2$(DEBUG_SUFFIX).pc python$(DEBUG_SUFFIX).pc)
|
|
|
|
|
|
|
|
# Install the interpreter with $(VERSION) affixed
|
|
|
|
# This goes into $(exec_prefix)
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -978,7 +984,7 @@ altbininstall: $(BUILDPYTHON)
|
2010-05-20 19:16:46 +00:00
|
|
|
else true; \
|
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
- $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
|
|
|
|
+ $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)$(EXE)
|
|
|
|
if test -f $(LDLIBRARY); then \
|
|
|
|
if test -n "$(DLLLIBRARY)" ; then \
|
|
|
|
$(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -1148,10 +1154,11 @@ $(srcdir)/Lib/$(PLATDIR):
|
Updated to Python 2.7.4.
- Refreshed patches: 0 (config), 7 (sqlite encoding), 16 (rpath in config),
55 (systemtap), 111 (no static lib), 112 (debug build), 113 (more
configuration flags), 130 (add extension to python config), 134 (fix
COUNT_ALLOCS in test_sys), 146 (haslib FIPS), 147 (add debug malloc stats),
153 (fix gdb test noise), 157 (uid, gid overflow - fixed upstream, just
keeping few more downstream tests), 165 (crypt module salt backport),
175 (fix configure Wformat), 5000 (regenerated autotooling patch)
- Dropped patches: 101 (lib64 regex; merged upstream), 171 (exception on
missing /dev/urandom; merged upstream), 172 (poll for multiprocessing socket
connection; merged upstream)
2013-04-09 08:54:58 +00:00
|
|
|
fi; \
|
2010-07-21 20:48:17 +00:00
|
|
|
cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
|
|
|
|
|
|
|
|
-python-config: $(srcdir)/Misc/python-config.in
|
|
|
|
+python$(DEBUG_SUFFIX)-config: $(srcdir)/Misc/python-config.in
|
|
|
|
# Substitution happens here, as the completely-expanded BINDIR
|
|
|
|
# is not available in configure
|
|
|
|
- sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
|
|
|
|
+ sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)$(EXE)," < $(srcdir)/Misc/python-config.in >python$(DEBUG_SUFFIX)-config
|
2016-07-17 20:28:26 +00:00
|
|
|
+
|
2010-07-21 20:48:17 +00:00
|
|
|
|
|
|
|
# Install the include files
|
|
|
|
INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -1172,13 +1179,13 @@ inclinstall:
|
2010-05-20 19:16:46 +00:00
|
|
|
$(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_SUFFIX)
|
|
|
|
+LIBPL= $(LIBP)/config$(DEBUG_SUFFIX)
|
2010-07-21 20:48:17 +00:00
|
|
|
|
|
|
|
# pkgconfig directory
|
|
|
|
LIBPC= $(LIBDIR)/pkgconfig
|
|
|
|
|
|
|
|
-libainstall: all python-config
|
|
|
|
+libainstall: all python$(DEBUG_SUFFIX)-config
|
|
|
|
@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
|
2010-05-20 19:16:46 +00:00
|
|
|
do \
|
2010-07-21 20:48:17 +00:00
|
|
|
if test ! -d $(DESTDIR)$$i; then \
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -1194,11 +1201,10 @@ libainstall: all python-config
|
2012-04-19 00:19:10 +00:00
|
|
|
$(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
|
|
|
|
$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
|
|
|
|
$(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
|
|
|
|
- $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
|
|
|
|
+ $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION)$(DEBUG_SUFFIX).pc
|
2010-07-21 20:48:17 +00:00
|
|
|
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
|
2010-05-20 19:16:46 +00:00
|
|
|
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
|
|
|
|
- $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
|
|
|
|
- rm python-config
|
|
|
|
+ $(INSTALL_SCRIPT) python$(DEBUG_SUFFIX)-config $(DESTDIR)$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)-config
|
|
|
|
@if [ -s Modules/python.exp -a \
|
|
|
|
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
|
|
|
|
echo; echo "Installing support files for building shared extension modules on AIX:"; \
|
2016-07-17 20:28:26 +00:00
|
|
|
diff --git a/Misc/python-config.in b/Misc/python-config.in
|
|
|
|
index a09e07c..c1691ef 100644
|
|
|
|
--- a/Misc/python-config.in
|
|
|
|
+++ b/Misc/python-config.in
|
|
|
|
@@ -44,7 +44,7 @@ for opt in opt_flags:
|
2014-12-11 09:37:25 +00:00
|
|
|
print ' '.join(flags)
|
2010-07-21 20:48:17 +00:00
|
|
|
|
|
|
|
elif opt in ('--libs', '--ldflags'):
|
2014-12-11 09:37:25 +00:00
|
|
|
- libs = ['-lpython' + pyver]
|
|
|
|
+ libs = ['-lpython' + pyver + (sys.pydebug and "_d" or "")]
|
|
|
|
libs += getvar('LIBS').split()
|
|
|
|
libs += getvar('SYSLIBS').split()
|
2010-07-21 20:48:17 +00:00
|
|
|
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
|
2016-07-17 20:28:26 +00:00
|
|
|
diff --git a/Modules/makesetup b/Modules/makesetup
|
2017-01-11 19:20:31 +00:00
|
|
|
index 1bffcbf..f0bc743 100755
|
2016-07-17 20:28:26 +00:00
|
|
|
--- a/Modules/makesetup
|
|
|
|
+++ b/Modules/makesetup
|
2010-05-20 19:16:46 +00:00
|
|
|
@@ -233,7 +233,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
|
|
|
|
*$mod.o*) base=$mod;;
|
|
|
|
*) base=${mod}module;;
|
|
|
|
esac
|
|
|
|
- file="$srcdir/$base\$(SO)"
|
|
|
|
+ file="$srcdir/$base\$(DEBUG_EXT)\$(SO)"
|
|
|
|
case $doconfig in
|
|
|
|
no) SHAREDMODS="$SHAREDMODS $file";;
|
|
|
|
esac
|
2016-07-17 20:28:26 +00:00
|
|
|
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
|
|
|
|
index 17ebab1..02a94aa 100644
|
|
|
|
--- a/Python/dynload_shlib.c
|
|
|
|
+++ b/Python/dynload_shlib.c
|
|
|
|
@@ -46,11 +46,16 @@ const struct filedescr _PyImport_DynLoadFiletab[] = {
|
2010-07-21 20:48:17 +00:00
|
|
|
{"module.exe", "rb", C_EXTENSION},
|
|
|
|
{"MODULE.EXE", "rb", C_EXTENSION},
|
2010-05-20 19:16:46 +00:00
|
|
|
#else
|
|
|
|
+#ifdef Py_DEBUG
|
2010-07-21 20:48:17 +00:00
|
|
|
+ {"_d.so", "rb", C_EXTENSION},
|
|
|
|
+ {"module_d.so", "rb", C_EXTENSION},
|
2010-05-20 19:16:46 +00:00
|
|
|
+#else
|
2010-07-21 20:48:17 +00:00
|
|
|
{".so", "rb", C_EXTENSION},
|
|
|
|
{"module.so", "rb", C_EXTENSION},
|
2010-05-20 19:16:46 +00:00
|
|
|
-#endif
|
|
|
|
-#endif
|
|
|
|
-#endif
|
|
|
|
+#endif /* Py_DEBUG */
|
|
|
|
+#endif /* __VMS */
|
|
|
|
+#endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */
|
|
|
|
+#endif /* __CYGWIN__ */
|
2010-07-21 20:48:17 +00:00
|
|
|
{0, 0}
|
2010-05-20 19:16:46 +00:00
|
|
|
};
|
|
|
|
|
2016-07-17 20:28:26 +00:00
|
|
|
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
|
2017-01-11 19:20:31 +00:00
|
|
|
index aeff38a..183e3cc 100644
|
2016-07-17 20:28:26 +00:00
|
|
|
--- a/Python/sysmodule.c
|
|
|
|
+++ b/Python/sysmodule.c
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -1524,6 +1524,12 @@ _PySys_Init(void)
|
2010-07-21 20:48:17 +00:00
|
|
|
PyString_FromString("legacy"));
|
|
|
|
#endif
|
2010-05-20 19:16:46 +00:00
|
|
|
|
|
|
|
+#ifdef Py_DEBUG
|
2016-07-17 20:28:26 +00:00
|
|
|
+ PyDict_SetItemString(sysdict, "pydebug", Py_True);
|
2010-05-20 19:16:46 +00:00
|
|
|
+#else
|
2016-07-17 20:28:26 +00:00
|
|
|
+ PyDict_SetItemString(sysdict, "pydebug", Py_False);
|
2010-05-20 19:16:46 +00:00
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#undef SET_SYS_FROM_STRING
|
2010-07-21 20:48:17 +00:00
|
|
|
if (PyErr_Occurred())
|
|
|
|
return NULL;
|
2016-07-17 20:28:26 +00:00
|
|
|
diff --git a/configure.ac b/configure.ac
|
2017-01-11 19:20:31 +00:00
|
|
|
index 0a902c7..5caedb7 100644
|
2016-07-17 20:28:26 +00:00
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -764,7 +764,7 @@ AC_SUBST(LIBRARY)
|
2014-01-29 13:20:07 +00:00
|
|
|
AC_MSG_CHECKING(LIBRARY)
|
|
|
|
if test -z "$LIBRARY"
|
|
|
|
then
|
|
|
|
- LIBRARY='libpython$(VERSION).a'
|
|
|
|
+ LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a'
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT($LIBRARY)
|
|
|
|
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -910,8 +910,8 @@ if test $enable_shared = "yes"; then
|
2014-01-29 13:20:07 +00:00
|
|
|
INSTSONAME="$LDLIBRARY".$SOVERSION
|
|
|
|
;;
|
|
|
|
Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
|
|
|
|
- LDLIBRARY='libpython$(VERSION).so'
|
|
|
|
- BLDLIBRARY='-L. -lpython$(VERSION)'
|
|
|
|
+ LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so'
|
|
|
|
+ BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)'
|
2014-06-04 13:11:57 +00:00
|
|
|
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
|
2014-01-29 13:20:07 +00:00
|
|
|
case $ac_sys_system in
|
|
|
|
FreeBSD*)
|
2017-01-11 19:20:31 +00:00
|
|
|
@@ -1040,6 +1040,14 @@ else AC_MSG_RESULT(no); Py_DEBUG='false'
|
2014-01-29 13:20:07 +00:00
|
|
|
fi],
|
|
|
|
[AC_MSG_RESULT(no)])
|
|
|
|
|
|
|
|
+if test "$Py_DEBUG" = 'true'
|
|
|
|
+then
|
|
|
|
+ DEBUG_EXT=_d
|
|
|
|
+ DEBUG_SUFFIX=-debug
|
|
|
|
+fi
|
|
|
|
+AC_SUBST(DEBUG_EXT)
|
|
|
|
+AC_SUBST(DEBUG_SUFFIX)
|
|
|
|
+
|
|
|
|
# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
|
|
|
|
# merged with this chunk of code?
|
|
|
|
|
2017-01-11 19:20:31 +00:00
|
|
|
--
|
|
|
|
2.11.0
|
|
|
|
|