[devel] AM_PYTHON_PATH und mailutils

Евгений Ростовцев real.altlinux.org на gmail.com
Пн Фев 15 10:43:55 UTC 2010


Привет!

Для ldv@:

Для AM_PATH_PYTHON предлагаю такое:
http://git.altlinux.org/people/real/packages/automake_1.11.git?p=automake_1.11.git;a=commitdiff;h=3e686343c9a004a2812073dceec247a239abb0f3

Он ничего не затронет, если специально не использовать эту фичу. Так
что, надеюсь, и апстрим пропустит.

Fix m4/python.m4 for archdep/noarch using
---

diff --git a/m4/python.m4 b/m4/python.m4
index 1dc3985..95a0989 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -34,6 +34,8 @@
 # numbers and dots only.
 AC_DEFUN([AM_PATH_PYTHON],
  [
+AC_ARG_VAR([python_noarch],
+[python_noarch  set python archdep/(=0)noarch(=1 or ="", default is 1])
   dnl Find a Python interpreter.  Python versions prior to 2.0 are not
   dnl supported. (2.0 was released on October 16, 2000).
   m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
@@ -121,82 +123,124 @@ python2.1 python2.0])
      else
        am_py_prefix=$prefix
      fi
-     am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils
import sysconfig;
sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))"
2>/dev/null ||
-     echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
-     case $am_cv_python_pythondir in
-     $am_py_prefix*)
-       am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
-       am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed
"s,^$am__strip_prefix,$PYTHON_PREFIX,"`
-       ;;
-     *)
-       case $am_py_prefix in
-         /usr|/System*) ;;
-         *)
-	  am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
-	  ;;
-       esac
-       ;;
-     esac
-    ])
-  AC_SUBST([pythondir], [$am_cv_python_pythondir])
-
-  dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
-  dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
-  dnl   more consistent with the rest of automake.
-
-  AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
-
-  dnl pyexecdir -- directory for installing python extension modules
-  dnl   (shared libraries)
-  dnl Query distutils for this directory.  distutils does not exist in
-  dnl Python 1.5, so we fall back to the hardcoded directory if it
-  dnl doesn't work.
-  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
-    [am_cv_python_pyexecdir],
-    [if test "x$exec_prefix" = xNONE
-     then
-       am_py_exec_prefix=$am_py_prefix
-     else
-       am_py_exec_prefix=$exec_prefix
-     fi
-     am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils
import sysconfig;
sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))"
2>/dev/null ||
-     echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
-     case $am_cv_python_pyexecdir in
-     $am_py_exec_prefix*)
-       am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
-       am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed
"s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
-       ;;
-     *)
-       case $am_py_exec_prefix in
-         /usr|/System*) ;;
-         *)
-	   am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
-	   ;;
-       esac
-       ;;
-     esac
-    ])
-  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
-
-  dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
-
-  AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
-
-  dnl Run any user-specified action.
-  $2
-  fi
-
-])
-
-
-# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
-# ---------------------------------------------------------------------------
-# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
-# Run ACTION-IF-FALSE otherwise.
-# This test uses sys.hexversion instead of the string equivalent (first
-# word of sys.version), in order to cope with versions such as 2.2c1.
-# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
-AC_DEFUN([AM_PYTHON_CHECK_VERSION],
+		 if test "$python_noarch" = "0"  && test "`uname -m`" = "x86_64" ; then
+			 libsuff='64'
+			 am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils
import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1))"
2>/dev/null ||
+			 echo "$PYTHON_PREFIX/lib$libsuff/python$PYTHON_VERSION/site-packages"`
+			 case $am_cv_python_pythondir in
+				 $am_py_prefix*)
+					 am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
+					 #am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed
"s,^$am__strip_prefix,$PYTHON_PREFIX,"`
+					 ;;
+				 *)
+					 case $am_py_prefix in
+						 /usr|/System*) ;;
+						 *)
+							 am_cv_python_pythondir=$PYTHON_PREFIX/lib$libsuff/python$PYTHON_VERSION/site-packages
+						 ;;
+					 esac
+				 ;;
+			 esac
+		 else
+				 libsuff=
+				 am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils
import sysconfig;
sys.stdout.write(sysconfig.get_python_lib(0,0,'$PYTHON_PREFIX'))"
2>/dev/null ||
+				 echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
+				 case $am_cv_python_pythondir in
+					 $am_py_prefix*)
+						 am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
+						 #am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed
"s,^$am__strip_prefix,$PYTHON_PREFIX,"`
+						 ;;
+					 *)
+						 case $am_py_prefix in
+							 /usr|/System*) ;;
+							 *)
+								am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
+						 	;;
+						esac
+					 ;;
+				 esac
+			 fi
+			])
+		AC_SUBST([pythondir], [$am_cv_python_pythondir])
+
+		dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
+		dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
+		dnl   more consistent with the rest of automake.
+
+		AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
+
+		dnl pyexecdir -- directory for installing python extension modules
+		dnl   (shared libraries)
+		dnl Query distutils for this directory.  distutils does not exist in
+		dnl Python 1.5, so we fall back to the hardcoded directory if it
+		dnl doesn't work.
+		AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
+			[am_cv_python_pyexecdir],
+			[if test "x$exec_prefix" = xNONE
+			 then
+				 am_py_exec_prefix=$am_py_prefix
+			 else
+				 am_py_exec_prefix=$exec_prefix
+			 fi
+			 if test "$python_noarch" = "0" && test "`uname -m`" = "x86_64" ; then
+				 libsuff='64'
+				 am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils
import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1))"
2>/dev/null ||
+				 echo "$PYTHON_EXEC_PREFIX/lib$libsuff/python$PYTHON_VERSION/site-packages"`
+				 case $am_cv_python_pyexecdir in
+					 $am_py_exec_prefix*)
+						 am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
+						 #am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed
"s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
+						 ;;
+					 *)
+						 case $am_py_exec_prefix in
+							 /usr|/System*) ;;
+							 *)
+					 am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib$libfuff/python$PYTHON_VERSION/site-packages
+					 ;;
+						 esac
+						 ;;
+				 esac
+			 else
+				 libsuff=
+				 am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils
import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0))"
2>/dev/null ||
+				 echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
+				 case $am_cv_python_pyexecdir in
+				 $am_py_exec_prefix*)
+					 am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
+					 #am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed
"s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
+					 ;;
+				 *)
+					 case $am_py_exec_prefix in
+						 /usr|/System*) ;;
+						 *)
+				 am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
+				 ;;
+					 esac
+					 ;;
+				 esac
+			 fi
+			])
+		AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
+
+		dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
+
+		AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
+
+		dnl Run any user-specified action.
+		$2
+		fi
+
+	])
+
+
+	# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+	# ---------------------------------------------------------------------------
+	# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
+	# Run ACTION-IF-FALSE otherwise.
+	# This test uses sys.hexversion instead of the string equivalent (first
+	# word of sys.version), in order to cope with versions such as 2.2c1.
+	# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
+	AC_DEFUN([AM_PYTHON_CHECK_VERSION],
  [prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
 # because we need at least 4 digits for the hex conversion.

А это для asy@ (mailutils):

1. Оставляем Ваш mailutils/configure.ac, впрочем, он и в моём
репозитории восстановлен.

2. http://git.altlinux.org/people/real/packages/mailutils.git?p=mailutils.git;a=commitdiff;h=5d1c4941972466829996be6bb04d16275f9ce96d

Я там немного подрихтовал спек, но сильно не увлекался. Для Вас
главное - параметр python_noarch=0 (единица или вообще пропущен
параметр - и всё будет собираться как сейчас, всё пихая в
%_libexecdir/python2.6) и замена %make_build на %make (сломалась
параллельная сборка).

- Fixed install of python
---

diff --git a/mailutils.spec b/mailutils.spec
index b0268cf..4f088b6 100644
--- a/mailutils.spec
+++ b/mailutils.spec
@@ -209,22 +209,23 @@ Python bindings for GNU Mailutils.
 %setup -q
 %endif

-%patch1 -p0
-sed -i "s|@TOP@|$PWD|" configure.ac
+#patch1 -p0

 gzip ChangeLog

 %build

+rm -f aclocal.m4
 %autoreconf
-sed -i 's|get_python_lib[^)]*|get_python_lib(1|' aclocal.m4

 %set_verify_elf_method unresolved=relaxed

 CFLAGS="-ltinfo"
-%configure --enable-mh-utils --with-mh-bindir=%_libexecdir/mu-mh
+%configure --enable-mh-utils --with-mh-bindir=%_libexecdir/mu-mh \
+	python_noarch=0

-%make_build
+# parallel build is broken
+%make

 %check

@@ -358,9 +359,8 @@ rm -f $RPM_BUILD_ROOT%python_sitelibdir/mailutils/c_api.la
 %python_sitelibdir/mailutils/*.py*

 %changelog
-* Sun Feb 07 2010 Eugeny A. Rostovtsev (REAL) <real at altlinux.org>
2.1-alt0.20091105.4
-- Fixed get_python_lib using
-- configure: .la war
+* Mon Feb 15 2010 Eugeny A. Rostovtsev (REAL) <real at altlinux.org>
2.1-alt0.20091105.4
+- Fixed install of python

 * Sun Jan 31 2010 Sergey Y. Afonin <asy на altlinux.ru> 2.1-alt0.20091105.3
 - created symlinks (for better exchangeability with the mailx package):


-- 
REAL aka Евгений Ростовцев, программист ЦНИТ КемГУ


Подробная информация о списке рассылки Devel