<p>Alexander Traud has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8675">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">BuildSystem: Go for Python 2 explicitly, because that is currently needed.<br><br>Currently, Asterisk is not compatible with Python 3. Because of PEP 394, do not<br>go for the general 'python' but the specific 'python2'. This avoids build<br>failures with<br>  make full<br>on platforms which use Python 3 as default already, like Arch Linux.<br><br>Furthermore, some platforms do not offer the shorthand 'python2', like NetBSD<br>and Gentoo Linux. For those platforms, Python must be called not only via its<br>major version but also via the minor version. In case of Python 2, this is easy,<br>because Python 2.7 was released already in mid-2010 and is going to be the last<br>minor version of that major version.<br><br>ASTERISK-27717<br><br>Change-Id: I29e694dc7e92510dc26b15895b55f78f67146b2c<br>---<br>M configure<br>M configure.ac<br>M contrib/scripts/install_prereq<br>3 files changed, 199 insertions(+), 16 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/75/8675/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/configure b/configure<br>index 5be181d..d16f8ae 100755<br>--- a/configure<br>+++ b/configure<br>@@ -6816,8 +6816,10 @@<br> fi<br> <br> <br>-# Extract the first word of "python", so it can be a program name with args.<br>-set dummy python; ac_word=$2<br>+for ac_prog in python2 python2.7<br>+do<br>+  # Extract the first word of "$ac_prog", so it can be a program name with args.<br>+set dummy $ac_prog; ac_word=$2<br> { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5<br> $as_echo_n "checking for $ac_word... " >&6; }<br> if ${ac_cv_path_PYTHON+:} false; then :<br>@@ -6843,7 +6845,6 @@<br>   done<br> IFS=$as_save_IFS<br> <br>-  test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON=":"<br>   ;;<br> esac<br> fi<br>@@ -6856,6 +6857,10 @@<br> $as_echo "no" >&6; }<br> fi<br> <br>+<br>+  test -n "$PYTHON" && break<br>+done<br>+test -n "$PYTHON" || PYTHON=":"<br> <br> # Extract the first word of "find", so it can be a program name with args.<br> set dummy find; ac_word=$2<br>@@ -25954,12 +25959,12 @@<br>     pkg_cv_PYTHONDEV_CFLAGS="$PYTHONDEV_CFLAGS"<br>  elif test -n "$PKG_CONFIG"; then<br>     if test -n "$PKG_CONFIG" && \<br>-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5<br>-  ($PKG_CONFIG --exists --print-errors "python") 2>&5<br>+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python < 3\""; } >&5<br>+  ($PKG_CONFIG --exists --print-errors "python < 3") 2>&5<br>   ac_status=$?<br>   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5<br>   test $ac_status = 0; }; then<br>-  pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python" 2>/dev/null`<br>+  pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python < 3" 2>/dev/null`<br>                    test "x$?" != "x0" && pkg_failed=yes<br> else<br>   pkg_failed=yes<br>@@ -25971,12 +25976,12 @@<br>     pkg_cv_PYTHONDEV_LIBS="$PYTHONDEV_LIBS"<br>  elif test -n "$PKG_CONFIG"; then<br>     if test -n "$PKG_CONFIG" && \<br>-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5<br>-  ($PKG_CONFIG --exists --print-errors "python") 2>&5<br>+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python < 3\""; } >&5<br>+  ($PKG_CONFIG --exists --print-errors "python < 3") 2>&5<br>   ac_status=$?<br>   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5<br>   test $ac_status = 0; }; then<br>-  pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python" 2>/dev/null`<br>+  pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python < 3" 2>/dev/null`<br>                test "x$?" != "x0" && pkg_failed=yes<br> else<br>   pkg_failed=yes<br>@@ -25997,9 +26002,185 @@<br>         _pkg_short_errors_supported=no<br> fi<br>         if test $_pkg_short_errors_supported = yes; then<br>-         PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python" 2>&1`<br>+              PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python < 3" 2>&1`<br>         else<br>-                PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python" 2>&1`<br>+             PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python < 3" 2>&1`<br>+        fi<br>+ # Put the nasty error message in config.log where it belongs<br>+ echo "$PYTHONDEV_PKG_ERRORS" >&5<br>+<br>+<br>+            PBX_PYTHONDEV=0<br>+<br>+<br>+elif test $pkg_failed = untried; then<br>+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>+$as_echo "no" >&6; }<br>+<br>+            PBX_PYTHONDEV=0<br>+<br>+<br>+else<br>+      PYTHONDEV_CFLAGS=$pkg_cv_PYTHONDEV_CFLAGS<br>+    PYTHONDEV_LIBS=$pkg_cv_PYTHONDEV_LIBS<br>+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>+$as_echo "yes" >&6; }<br>+<br>+            PBX_PYTHONDEV=1<br>+            PYTHONDEV_INCLUDE="$PYTHONDEV_CFLAGS"<br>+            PYTHONDEV_LIB="$PYTHONDEV_LIBS"<br>+<br>+$as_echo "#define HAVE_PYTHONDEV 1" >>confdefs.h<br>+<br>+<br>+fi<br>+   fi<br>+<br>+<br>+   if test "x${PBX_PYTHONDEV}" != "x1" -a "${USE_PYTHONDEV}" != "no"; then<br>+<br>+pkg_failed=no<br>+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYTHONDEV" >&5<br>+$as_echo_n "checking for PYTHONDEV... " >&6; }<br>+<br>+if test -n "$PYTHONDEV_CFLAGS"; then<br>+    pkg_cv_PYTHONDEV_CFLAGS="$PYTHONDEV_CFLAGS"<br>+ elif test -n "$PKG_CONFIG"; then<br>+    if test -n "$PKG_CONFIG" && \<br>+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python2\""; } >&5<br>+  ($PKG_CONFIG --exists --print-errors "python2") 2>&5<br>+  ac_status=$?<br>+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5<br>+  test $ac_status = 0; }; then<br>+  pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python2" 2>/dev/null`<br>+                   test "x$?" != "x0" && pkg_failed=yes<br>+else<br>+  pkg_failed=yes<br>+fi<br>+ else<br>+    pkg_failed=untried<br>+fi<br>+if test -n "$PYTHONDEV_LIBS"; then<br>+    pkg_cv_PYTHONDEV_LIBS="$PYTHONDEV_LIBS"<br>+ elif test -n "$PKG_CONFIG"; then<br>+    if test -n "$PKG_CONFIG" && \<br>+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python2\""; } >&5<br>+  ($PKG_CONFIG --exists --print-errors "python2") 2>&5<br>+  ac_status=$?<br>+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5<br>+  test $ac_status = 0; }; then<br>+  pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python2" 2>/dev/null`<br>+                test "x$?" != "x0" && pkg_failed=yes<br>+else<br>+  pkg_failed=yes<br>+fi<br>+ else<br>+    pkg_failed=untried<br>+fi<br>+<br>+<br>+<br>+if test $pkg_failed = yes; then<br>+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>+$as_echo "no" >&6; }<br>+<br>+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then<br>+        _pkg_short_errors_supported=yes<br>+else<br>+        _pkg_short_errors_supported=no<br>+fi<br>+        if test $_pkg_short_errors_supported = yes; then<br>+               PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python2" 2>&1`<br>+        else<br>+              PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python2" 2>&1`<br>+        fi<br>+       # Put the nasty error message in config.log where it belongs<br>+ echo "$PYTHONDEV_PKG_ERRORS" >&5<br>+<br>+<br>+            PBX_PYTHONDEV=0<br>+<br>+<br>+elif test $pkg_failed = untried; then<br>+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>+$as_echo "no" >&6; }<br>+<br>+            PBX_PYTHONDEV=0<br>+<br>+<br>+else<br>+      PYTHONDEV_CFLAGS=$pkg_cv_PYTHONDEV_CFLAGS<br>+    PYTHONDEV_LIBS=$pkg_cv_PYTHONDEV_LIBS<br>+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>+$as_echo "yes" >&6; }<br>+<br>+            PBX_PYTHONDEV=1<br>+            PYTHONDEV_INCLUDE="$PYTHONDEV_CFLAGS"<br>+            PYTHONDEV_LIB="$PYTHONDEV_LIBS"<br>+<br>+$as_echo "#define HAVE_PYTHONDEV 1" >>confdefs.h<br>+<br>+<br>+fi<br>+   fi<br>+<br>+<br>+   if test "x${PBX_PYTHONDEV}" != "x1" -a "${USE_PYTHONDEV}" != "no"; then<br>+<br>+pkg_failed=no<br>+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYTHONDEV" >&5<br>+$as_echo_n "checking for PYTHONDEV... " >&6; }<br>+<br>+if test -n "$PYTHONDEV_CFLAGS"; then<br>+    pkg_cv_PYTHONDEV_CFLAGS="$PYTHONDEV_CFLAGS"<br>+ elif test -n "$PKG_CONFIG"; then<br>+    if test -n "$PKG_CONFIG" && \<br>+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-2.7\""; } >&5<br>+  ($PKG_CONFIG --exists --print-errors "python-2.7") 2>&5<br>+  ac_status=$?<br>+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5<br>+  test $ac_status = 0; }; then<br>+  pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python-2.7" 2>/dev/null`<br>+                  test "x$?" != "x0" && pkg_failed=yes<br>+else<br>+  pkg_failed=yes<br>+fi<br>+ else<br>+    pkg_failed=untried<br>+fi<br>+if test -n "$PYTHONDEV_LIBS"; then<br>+    pkg_cv_PYTHONDEV_LIBS="$PYTHONDEV_LIBS"<br>+ elif test -n "$PKG_CONFIG"; then<br>+    if test -n "$PKG_CONFIG" && \<br>+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-2.7\""; } >&5<br>+  ($PKG_CONFIG --exists --print-errors "python-2.7") 2>&5<br>+  ac_status=$?<br>+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5<br>+  test $ac_status = 0; }; then<br>+  pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python-2.7" 2>/dev/null`<br>+               test "x$?" != "x0" && pkg_failed=yes<br>+else<br>+  pkg_failed=yes<br>+fi<br>+ else<br>+    pkg_failed=untried<br>+fi<br>+<br>+<br>+<br>+if test $pkg_failed = yes; then<br>+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>+$as_echo "no" >&6; }<br>+<br>+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then<br>+        _pkg_short_errors_supported=yes<br>+else<br>+        _pkg_short_errors_supported=no<br>+fi<br>+        if test $_pkg_short_errors_supported = yes; then<br>+               PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python-2.7" 2>&1`<br>+        else<br>+           PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python-2.7" 2>&1`<br>         fi<br>     # Put the nasty error message in config.log where it belongs<br>  echo "$PYTHONDEV_PKG_ERRORS" >&5<br>diff --git a/configure.ac b/configure.ac<br>index 0608938..2e9a1ee 100644<br>--- a/configure.ac<br>+++ b/configure.ac<br>@@ -261,7 +261,7 @@<br> AC_PATH_PROG([CUT], [cut], :)<br> AC_PATH_PROG([FLEX], [flex], :)<br> AC_PATH_PROG([GREP], [grep], :)<br>-AC_PATH_PROG([PYTHON], [python], :)<br>+AC_PATH_PROGS([PYTHON], [python2 python2.7], :)<br> AC_PATH_PROG([FIND], [find], :)<br> AC_PATH_PROG([COMPRESS], [compress], :)<br> AC_PATH_PROG([BASENAME], [basename], :)<br>@@ -2312,7 +2312,9 @@<br> <br> AC_SUBST([PYTHONDEV_LIB])<br> AC_SUBST([PYTHONDEV_INCLUDE])<br>-AST_PKG_CONFIG_CHECK([PYTHONDEV], [python])<br>+AST_PKG_CONFIG_CHECK([PYTHONDEV], [python < 3])<br>+AST_PKG_CONFIG_CHECK([PYTHONDEV], [python2])<br>+AST_PKG_CONFIG_CHECK([PYTHONDEV], [python-2.7])<br> <br> AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])<br> <br>diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq<br>index 887c5e2..394e1e1 100755<br>--- a/contrib/scripts/install_prereq<br>+++ b/contrib/scripts/install_prereq<br>@@ -32,7 +32,7 @@<br> # Asterisk: for the unpackaged below:<br> PACKAGES_DEBIAN="$PACKAGES_DEBIAN wget subversion"<br> # Asterisk: for ./configure --with-pjproject-bundled:<br>-PACKAGES_DEBIAN="$PACKAGES_DEBIAN bzip2 patch python-dev"<br>+PACKAGES_DEBIAN="$PACKAGES_DEBIAN bzip2 patch python2.7-dev"<br> <br> # Basic build system:<br> PACKAGES_RH="make gcc gcc-c++ pkgconfig"<br>@@ -48,7 +48,7 @@<br> # Asterisk: for the unpackaged below:<br> PACKAGES_RH="$PACKAGES_RH wget subversion"<br> # Asterisk: for ./configure --with-pjproject-bundled:<br>-PACKAGES_RH="$PACKAGES_RH bzip2 patch python-devel"<br>+PACKAGES_RH="$PACKAGES_RH bzip2 patch python2-devel"<br> <br> # Basic build system:<br> PACKAGES_SUSE="make gcc gcc-c++ pkg-config"<br>@@ -128,7 +128,7 @@<br> # Asterisk: for the unpackaged below:<br> PACKAGES_FBSD="$PACKAGES_FBSD wget subversion"<br> # Asterisk: for ./configure --with-pjproject-bundled:<br>-PACKAGES_FBSD="$PACKAGES_FBSD bzip2 patch python"<br>+PACKAGES_FBSD="$PACKAGES_FBSD bzip2 patch python2"<br> <br> KVERS=`uname -r`<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8675">change 8675</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8675"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I29e694dc7e92510dc26b15895b55f78f67146b2c </div>
<div style="display:none"> Gerrit-Change-Number: 8675 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>