Hello,
I'm trying to build PJSIP and its Python bindings on Arch Linux. The
former builds successfully, but the latter fails.
Arch has Python 3.7 in its repos, but the bindings' Makefile expects
Python 3.6. I have attached a patch which addresses this issue by
asking the actual python executable (either python2
or python3
)
which version it has.
The second hunk of the attached patch makes the installation process
honor the DESTDIR
variable. This is most often used by packaging
tools, which is why I simply disallow the "uninstall" target if DESTDIR
is non-empty - uninstalling makes no sense in that context. Adding --optimize=1
here is recommended by Arch's python packaging
guidelines, as it allows the package manager to track the compiled
files.
The next problem lies within the bindings themselves. Python 3.7
introduces the keyword "async", which means this can no longer be used
as variable name. Attempting to do so results in the following error
(both with release 2.8 as well as latest SVN):
make[1]: Entering directory '/build/pjproject-svn/src/pjproject/pjsip-apps/src/swig/python'
if [ "/build/pjproject-svn/pkg/python-pjproject-svn" ]; then
python3 setup.py install --root="/build/pjproject-svn/pkg/python-pjproject-svn/" --optimize=1;
else
python3 setup.py install --user;
fi
running install
running build
running build_py
running build_ext
running install_lib
creating /build/pjproject-svn/pkg/python-pjproject-svn/usr
creating /build/pjproject-svn/pkg/python-pjproject-svn/usr/lib
creating /build/pjproject-svn/pkg/python-pjproject-svn/usr/lib/python3.7
creating /build/pjproject-svn/pkg/python-pjproject-svn/usr/lib/python3.7/site-packages
copying build/lib.linux-x86_64-3.7/pjsua2.py -> /build/pjproject-svn/pkg/python-pjproject-svn/usr/lib/python3.7/site-packages
copying build/lib.linux-x86_64-3.7/_pjsua2.cpython-37m-x86_64-linux-gnu.so -> /build/pjproject-svn/pkg/python-pjproject-svn/usr/lib/python3.7/site-packages
byte-compiling /build/pjproject-svn/pkg/python-pjproject-svn/usr/lib/python3.7/site-packages/pjsua2.py to pjsua2.cpython-37.pyc
writing byte-compilation script '/tmp/tmpakk7h67h.py'
/usr/bin/python3 /tmp/tmpakk7h67h.py
File "usr/lib/python3.7/site-packages/pjsua2.py", line 7595
async = _swig_property(_pjsua2.OnCallRxReinviteParam_async_get, _pjsua2.OnCallRxReinviteParam_async_set)
^
SyntaxError: invalid syntax
removing /tmp/tmpakk7h67h.py
running install_egg_info
Writing /build/pjproject-svn/pkg/python-pjproject-svn/usr/lib/python3.7/site-packages/pjsua2-2.8_svn-py3.7.egg-info
File "usr/lib/python3.7/site-packages/pjsua2.py", line 7595
async = _swig_property(_pjsua2.OnCallRxReinviteParam_async_get, _pjsua2.OnCallRxReinviteParam_async_set)
^
SyntaxError: invalid syntax
make[1]: Leaving directory '/build/pjproject-svn/src/pjproject/pjsip-apps/src/swig/python'
I hope that this can be resolved quickly; don't hesitate to ask if you
need any more information.
~ Wüstengecko