Changeset: a1826ecde882 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a1826ecde882
Modified Files:
        configure.ag
        testing/Mtest.py.in
Branch: Oct2012
Log Message:

python: fix PYTHONX_LIBDIR values, bug #3207


diffs (71 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1179,10 +1179,15 @@ if test "x$have_python2" != xno; then
                        fi
                        case "$host_os-`"$PYTHON2" -V 2>&1`" in
                                darwin9*-*2.5.1)
-                                       PYTHON2_LIBDIR="`"$PYTHON2" -c 'import 
distutils.sysconfig; print distutils.sysconfig.get_python_lib(0,1,"")' 
2>/dev/null`/site-packages";;
+                                       # This is the Python installed on OSX 
Leopard, in
+                                       # later versions of OSX, Python is 
fixed to return
+                                       # standard output
+                                       PYTHON2_LIBDIR="`"$PYTHON2" -c 'import 
distutils.sysconfig; print 
distutils.sysconfig.get_python_lib(0,1,"'"$Qprefix"'")' 
2>/dev/null`/site-packages";;
                                *)
-                                       PYTHON2_LIBDIR="`"$PYTHON2" -c 'import 
distutils.sysconfig; print distutils.sysconfig.get_python_lib(0,0,"")' 
2>/dev/null`";;
+                                       # Use prefix field for Ubuntu Python, 
bug #3207
+                                       PYTHON2_LIBDIR="`"$PYTHON2" -c 'import 
distutils.sysconfig; print 
distutils.sysconfig.get_python_lib(0,0,"'"$Qprefix"'")' 2>/dev/null`";;
                        esac
+                       PYTHON2_LIBDIR=`echo "$PYTHON2_LIBDIR" | sed 
"s|^$Qprefix/||"`
                        ;;
                no)     ;;
                $Qprefix/*) dnl dubious
@@ -1233,7 +1238,9 @@ if test "x$have_python3" != xno; then
                        if test x$cross_compiling = xyes; then
                                AC_MSG_ERROR([Must specify 
--with-python3-libdir when cross compiling])
                        fi
-                       PYTHON3_LIBDIR="`"$PYTHON3" -c 'import 
distutils.sysconfig; print(distutils.sysconfig.get_python_lib(0,0,""))' 
2>/dev/null`"
+                       # Use prefix field for Ubuntu Python, bug #3207
+                       PYTHON3_LIBDIR="`"$PYTHON3" -c 'import 
distutils.sysconfig; 
print(distutils.sysconfig.get_python_lib(0,0,"'"$Qprefix"'"))' 2>/dev/null`"
+                       PYTHON3_LIBDIR=`echo "$PYTHON3_LIBDIR" | sed 
"s|^$Qprefix/||"`
                        ;;
                no)     ;;
                $Qprefix/*) dnl dubious
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -144,21 +144,7 @@ except ImportError:
     try:
         import MonetDBtesting.subprocess26 as subprocess
     except ImportError:
-        import distutils.sysconfig
-        if os.name != "nt" and os.uname()[0] + os.uname()[2][:1] == "Darwin9" 
and sys.version[:5] == "2.5.1":
-            p = 
_configure(os.path.join('@QXprefix@',distutils.sysconfig.get_python_lib(0,1,""),'site-packages'))
-        else:
-            p = distutils.sysconfig.get_python_lib(0, 0, '')
-            if p.endswith('dist-packages'):
-                # Ubuntu
-                p = p.replace('dist-packages', 'site-packages')
-                _configure(os.path.join('@QXprefix@', p))
-                sys.path.insert(0, p)
-                if os.environ.has_key('PYTHONPATH'):
-                    p += os.pathsep + os.environ['PYTHONPATH']
-                os.environ['PYTHONPATH'] = p
-                p = distutils.sysconfig.get_python_lib(0, 0, '')
-            p = _configure(os.path.join('@QXprefix@', p))
+        p = _configure(os.path.join('@QXprefix@', '@PYTHON2_LIBDIR@'))
         sys.path.insert(0, p)
         import MonetDBtesting.subprocess26 as subprocess
         if os.environ.has_key('PYTHONPATH'):
@@ -254,11 +240,7 @@ except ImportError:
     try:
         from MonetDBtesting import monet_options
     except ImportError:
-        import distutils.sysconfig
-        if os.name != "nt" and os.uname()[0] + os.uname()[2][:1] == "Darwin9" 
and sys.version[:5] == "2.5.1":
-            p = 
_configure(os.path.join('@QXprefix@',distutils.sysconfig.get_python_lib(0,1,""),'site-packages'))
-        else:
-            p = 
_configure(os.path.join('@QXprefix@',distutils.sysconfig.get_python_lib(0,0,"")))
+        p = _configure(os.path.join('@QXprefix@', '@PYTHON2_LIBDIR@'))
         sys.path.insert(0, p)
         from MonetDBtesting import monet_options
         if os.environ.has_key('PYTHONPATH'):
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to