aboutsummaryrefslogtreecommitdiff
path: root/examples/python2.7/patches/pydebug-path.dpatch
diff options
context:
space:
mode:
Diffstat (limited to 'examples/python2.7/patches/pydebug-path.dpatch')
-rw-r--r--examples/python2.7/patches/pydebug-path.dpatch100
1 files changed, 100 insertions, 0 deletions
diff --git a/examples/python2.7/patches/pydebug-path.dpatch b/examples/python2.7/patches/pydebug-path.dpatch
new file mode 100644
index 0000000..652ff3b
--- /dev/null
+++ b/examples/python2.7/patches/pydebug-path.dpatch
@@ -0,0 +1,100 @@
+#! /bin/sh -e
+
+# DP: When built with --with-pydebug, add a debug directory
+# DP: <prefix>/lib-dynload/debug to sys.path just before
+# DP: <prefix>/lib-dynload und install the extension modules
+# DP: of the debug build in this directory.
+
+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 -p0 < $0
+ ;;
+ -unpatch)
+ patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+ ;;
+ *)
+ echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+ exit 1
+esac
+exit 0
+
+--- Modules/getpath.c.orig 2005-01-18 00:56:31.571961744 +0100
++++ Modules/getpath.c 2005-01-18 01:02:23.811413208 +0100
+@@ -112,9 +112,14 @@
+ #endif
+
+ #ifndef PYTHONPATH
++#ifdef Py_DEBUG
++#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
++ EXEC_PREFIX "/lib/python" VERSION "/lib-dynload/debug"
++#else
+ #define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
+ EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
+ #endif
++#endif
+
+ #ifndef LANDMARK
+ #define LANDMARK "os.py"
+@@ -323,6 +328,9 @@
+ strncpy(exec_prefix, home, MAXPATHLEN);
+ joinpath(exec_prefix, lib_python);
+ joinpath(exec_prefix, "lib-dynload");
++#ifdef Py_DEBUG
++ joinpath(exec_prefix, "debug");
++#endif
+ return 1;
+ }
+
+@@ -340,6 +348,9 @@
+ n = strlen(exec_prefix);
+ joinpath(exec_prefix, lib_python);
+ joinpath(exec_prefix, "lib-dynload");
++#ifdef Py_DEBUG
++ joinpath(exec_prefix, "debug");
++#endif
+ if (isdir(exec_prefix))
+ return 1;
+ exec_prefix[n] = '\0';
+@@ -350,6 +361,9 @@
+ strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
+ joinpath(exec_prefix, lib_python);
+ joinpath(exec_prefix, "lib-dynload");
++#ifdef Py_DEBUG
++ joinpath(exec_prefix, "debug");
++#endif
+ if (isdir(exec_prefix))
+ return 1;
+
+@@ -654,6 +654,9 @@
+ reduce(exec_prefix);
+ reduce(exec_prefix);
+ reduce(exec_prefix);
++#ifdef Py_DEBUG
++ reduce(exec_prefix);
++#endif
+ if (!exec_prefix[0])
+ strcpy(exec_prefix, separator);
+ }
+--- Lib/site.py~ 2004-12-04 00:39:05.000000000 +0100
++++ Lib/site.py 2005-01-18 01:33:36.589707632 +0100
+@@ -188,6 +188,12 @@
+ "python" + sys.version[:3],
+ "site-packages"),
+ os.path.join(prefix, "lib", "site-python")]
++ try:
++ # sys.getobjects only available in --with-pydebug build
++ sys.getobjects
++ sitedirs.insert(0, os.path.join(sitedirs[0], 'debug'))
++ except AttributeError:
++ pass
+ else:
+ sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
+ if sys.platform == 'darwin':