summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2015-08-28 14:09:53 -0700
committerJosh Gao <jmgao@google.com>2015-08-28 14:17:26 -0700
commite5bb9c11408ff3e1774dc23e91a907d771c818b8 (patch)
tree24d29f746abbc8ee7a0a0131e027274dfb2e7dde
parentb7811603a7e3aba7db9453d81a677dda40cca435 (diff)
downloadpython-e5bb9c11408ff3e1774dc23e91a907d771c818b8.tar.gz
Fix broken path rewriting in python-config.sh.
python-config.sh was running the same sed invocation on a string multiple times, resulting in paths like /usr/local/google/usr/local/google/tmp/... being generated. Change-Id: I321c51b44268ad62c38aa45ea5a94746f2de0c06
-rw-r--r--Python-2.7.5/Misc/python-config.sh.in22
1 files changed, 16 insertions, 6 deletions
diff --git a/Python-2.7.5/Misc/python-config.sh.in b/Python-2.7.5/Misc/python-config.sh.in
index 7f8dfaa..9cffaca 100644
--- a/Python-2.7.5/Misc/python-config.sh.in
+++ b/Python-2.7.5/Misc/python-config.sh.in
@@ -34,13 +34,23 @@ installed_prefix ()
prefix_build="@prefix@"
prefix_real=$(installed_prefix "$0")
-# Use sed to fix paths from their built to locations to their installed to locations.
-prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#")
exec_prefix_build="@exec_prefix@"
-exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#")
-includedir=$(echo "@includedir@" | sed "s#$prefix_build#$prefix_real#")
-libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#")
-CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#")
+exec_prefix_real="$prefix_real"
+
+# Use sed to fix paths from their built to locations to their installed to locations.
+
+# The @includedir@ and @libdir@ macros can be '$prefix/include' and the like, so we
+# need to avoid replacing the prefix multiple times.
+prefix="$prefix_build"
+exec_prefix="$exec_prefix_build"
+
+includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#")
+libdir=$(echo "@libdir@" | sed "s#^$prefix_build#$prefix_real#")
+
+prefix="$prefix_real"
+exec_prefix="$exec_prefix_real"
+
+CFLAGS="@CFLAGS@"
VERSION="@VERSION@"
LIBM="@LIBM@"
LIBC="@LIBC@"