Summary: | ASTERISK-27717: [patch] BuildSystem: In NetBSD, the Python Programming Language is python-2.7. | ||
Reporter: | Alexander Traud (traud) | Labels: | patch pjsip |
Date Opened: | 2018-03-05 06:41:25.000-0600 | Date Closed: | 2020-04-13 16:51:37 |
Priority: | Minor | Regression? | |
Status: | Closed/Complete | Components: | Core/BuildSystem Tests/testsuite |
Versions: | 13.20.0 15.3.0 | Frequency of Occurrence | |
Related Issues: | |||
Environment: | Arch Linux (rolling release) DragonFly BSD 5.2 Gentoo Linux 17.0 NetBSD 7.1.1 Ubuntu 18.04 LTS | Attachments: | ( 0) NetBSD_enable_python_revision_2.patch ( 1) NetBSD_enable_python_revision_3.patch ( 2) NetBSD_enable_python.patch |
Description: | The script {{./configure}} assumes that Python 2.x has a tool named 'python' and is listed in the tool {{pkg-config}} as 'python'. However, on some platforms, no default Python package exists. Python 2.x and Python 3.x can be installed side by side and each gets its own path/name. For example in NetBSD, the package python27 installs
* {{/usr/pkg/bin/python2.7}} (without a dash) and * {{/usr/pkg/lib/pkgconf/python-2.7.pc}}. Therefore, Python could not be used by Asterisk in NetBSD. | ||
Comments: | By: Asterisk Team (asteriskteam) 2018-03-05 06:41:26.220-0600 Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report. Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process]. By: Friendly Automation (friendly-automation) 2018-03-20 10:39:27.602-0500 Change 8425 merged by Jenkins2: BuildSystem: In NetBSD, the Python Programming Language is python-X.Y. [https://gerrit.asterisk.org/8425|https://gerrit.asterisk.org/8425] By: Friendly Automation (friendly-automation) 2018-03-20 10:39:33.622-0500 Change 8424 merged by George Joseph: BuildSystem: In NetBSD, the Python Programming Language is python-X.Y. [https://gerrit.asterisk.org/8424|https://gerrit.asterisk.org/8424] By: Friendly Automation (friendly-automation) 2018-03-20 10:52:59.908-0500 Change 8426 merged by Jenkins2: BuildSystem: In NetBSD, the Python Programming Language is python-X.Y. [https://gerrit.asterisk.org/8426|https://gerrit.asterisk.org/8426] By: Alexander Traud (traud) 2018-03-23 06:04:54.572-0500 Similar is true for Gentoo Linux (17.0): {{/usr/bin/python2.7}} and {{/usr/bin/python2}} exist, but for the tool {{pkg-config}} only 'python-2.7' works. Neither 'python', 'python2', 'python-2', nor something like 'python >= 2' work. Furthermore in Gentoo Linux and Arch Linux, {{/usr/bin/python}} defaults to Python 3.x already. However, {{make full}} does not work with Python 3.x, yet. By: Asterisk Team (asteriskteam) 2018-03-23 06:04:54.836-0500 This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable. By: Alexander Traud (traud) 2018-03-27 05:13:41.593-0500 After being accepted, the initial change got reverted because of three misunderstandings of mine: 1. The script configure looks for the Python runtime tool and Python shared libraries. The shared libraries are used only when the bundled PJProject is used, see {{PYTHONDEV_LIB}} in the file {{./third_party/pjproject/Makefile}}. Furthermore, the {{TEST_FRAMEWORK}} must be enabled in the Asterisk tool {{menuselect}}. 2. The {{TEST_FRAMEWORK}} is only available if the developer mode was activated via the script {{./configure}}. Consequently, the following steps are required in Ubuntu 16.04 LTS to reproduce the issue, which led to the revert of the change:{code}sudo apt install build-essential pkg-config autoconf automake sudo apt install libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxml2-dev sudo apt install bzip2 patch python3-dev wget downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz tar -zxf ./asterisk-*-current.tar.gz cd ./asterisk-* wget issues.asterisk.org/jira/secure/attachment/57262/NetBSD_enable_python_revision_2.patch patch -p0 <./NetBSD_enable_python_revision_2.patch ./bootstrap.sh ./configure --with-pjproject-bundled --enable-dev-mode make menuselect.makeopts ./menuselect/menuselect --enable TEST_FRAMEWORK make full{code} 3. Scripts created for Python 2 are not always compatible with Python 3. In the Makefile, the detected Python runtime tool is used for the target {{doc/full-en_US.xml}} (which is accessible via {{make full}}) and the target {{ari-stubs}}. Both are not Python 3 compatible, yet (see [Gerrit 8646|http://gerrit.asterisk.org/8646]). Therefore, it was correct to use AC_PATH_PROG with _python2.7_ instead of the general _python_ (see [PEP 394|http://www.python.org/dev/peps/pep-0394/]). Since PJProject 2.7, Teluu [claims to be|http://trac.pjsip.org/repos/ticket/2034] compatible with Python 3 and use that on default. For example in Ubuntu 16.04 LTS, Teluu’s Python bindings for the PJSIP User Agent (PJSUA) are built by: {code}sudo apt install build-essential bzip2 python3-dev swig wget www.pjsip.org/release/latest/pjproject.tar.bz2 tar -jxf ./pjproject.tar.bz2 cd ./pjproject CXXFLAGS='-std=c++03' ./configure --enabled-shared make dep all sudo make install cd ./pjsip-apps/src/swig make sudo make install{code}SWIG is a tool, so the end-user is able to create the Python bindings himself, see their [current documentation|http://www.pjsip.org/docs/book-latest/html/intro_pjsua2.html#building-pjsua2]. The PJProject must be compiled with {{\-fPIC}} (thanks to [Luke Biddle|http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2017-November/040789.html]), therefore I went for {{\-\-enabled-shared}}. It is possible to edit (!) the Makefile, to use Python 2 instead of Python 3. Both variants of that binding work on the officially supported platforms by Asterisk. However, that are the Python bindings for PJSUA2. Instead, Asterisk uses older Python bindings from Teluu, which are located in {{./pjsip-apps/src/python}}. Those bindings did not need SWIG. As of today, those bindings are Python 2 only, see their [current documentation…|http://trac.pjsip.org/repos/wiki/Python_SIP/Build_Install] Until Asterisk is updated to use those newer bindings, Asterisk has to use Python 2 for the shared libraries and those bindings as well. Consequently in the script {{./configure}}, AST_PKG_CONFIG_CHECK must be called not with _python_ but _python-2.7_. By: Alexander Traud (traud) 2018-03-29 03:16:46.178-0500 DragonFly BSD behaves like NetBSD, when it coms to Python: * python does not exist * python2 does not exits * python2.7 is the tool and python-2.7 is the string for pkg-config. By: Alexander Traud (traud) 2018-04-03 13:25:01.208-0500 Teluu confirmed that the Python binding used by Asterisk for its Test Framework is deprecated. Anyway, until everything is updated to that new binding and therefore Python 3 compatible, let us look for python{-}2.7. By: Alexander Traud (traud) 2018-04-19 03:27:43.953-0500 The work on the Test Framework is continued in ASTERISK-27787. By: Alexander Traud (traud) 2018-06-06 07:14:51.236-0500 In Ubuntu 18.04 LTS, AC_PATH_PROG fails for 'python' because [python-minimal|https://packages.ubuntu.com/bionic/python-minimal] is not installed on default anymore. However, [python3|https://packages.ubuntu.com/bionic/python3] is. Consequently, a search for 'python3.6' would succeed. By: Friendly Automation (friendly-automation) 2020-04-13 16:51:40.220-0500 Change 14176 merged by Friendly Automation: BuildSystem: Search for Python/C API when possibly needed only. [https://gerrit.asterisk.org/c/asterisk/+/14176|https://gerrit.asterisk.org/c/asterisk/+/14176] By: Friendly Automation (friendly-automation) 2020-04-13 16:52:53.114-0500 Change 14177 merged by Friendly Automation: BuildSystem: Search for Python/C API when possibly needed only. [https://gerrit.asterisk.org/c/asterisk/+/14177|https://gerrit.asterisk.org/c/asterisk/+/14177] By: Friendly Automation (friendly-automation) 2020-04-13 16:56:20.238-0500 Change 14175 merged by Friendly Automation: BuildSystem: Search for Python/C API when possibly needed only. [https://gerrit.asterisk.org/c/asterisk/+/14175|https://gerrit.asterisk.org/c/asterisk/+/14175] By: Friendly Automation (friendly-automation) 2020-04-13 17:23:10.475-0500 Change 14149 merged by Friendly Automation: BuildSystem: Search for Python/C API when possibly needed only. [https://gerrit.asterisk.org/c/asterisk/+/14149|https://gerrit.asterisk.org/c/asterisk/+/14149] By: Friendly Automation (friendly-automation) 2020-04-30 10:51:40.650-0500 Change 14369 merged by George Joseph: BuildSystem: Search for Python/C API when possibly needed only. [https://gerrit.asterisk.org/c/asterisk/+/14369|https://gerrit.asterisk.org/c/asterisk/+/14369] |