Discussion:
[Freeswitch-users] ESL python library for python3
Iqbal Abdullah
2015-05-16 14:30:24 UTC
Permalink
Hello,

I've managed to compile, install and use the python esl library from
freeswitch 1.4.18, but am now wondering is there a way to get the
python esl library for python3?

I've tried changing the Makefiles in libs/esl/python to point to
python3 and made sure my dev packages are installed, but the
compilation failed.

Does the python esl module supports python3?

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
***@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-***@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Michael Jerris
2015-05-18 18:54:51 UTC
Permalink
I don't think we have ever tried it, but we would be happy to take pull requests to fix any issues with it.
Post by Iqbal Abdullah
Hello,
I've managed to compile, install and use the python esl library from
freeswitch 1.4.18, but am now wondering is there a way to get the
python esl library for python3?
I've tried changing the Makefiles in libs/esl/python to point to
python3 and made sure my dev packages are installed, but the
compilation failed.
Does the python esl module supports python3?
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
***@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-***@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Iqbal Abdullah
2015-05-18 19:00:17 UTC
Permalink
Michael,

I have managed to build the library againts py3 and will make a pull
request later.
Post by Michael Jerris
I don't think we have ever tried it, but we would be happy to take pull
requests to fix any issues with it.
Post by Iqbal Abdullah
Hello,
I've managed to compile, install and use the python esl library from
freeswitch 1.4.18, but am now wondering is there a way to get the
python esl library for python3?
I've tried changing the Makefiles in libs/esl/python to point to
python3 and made sure my dev packages are installed, but the
compilation failed.
Does the python esl module supports python3?
_________________________________________________________________________
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Michael Jerris
2015-05-18 19:05:14 UTC
Permalink
we will need some way that uses configure to detect the right python, and builds against old and new python.
Post by Iqbal Abdullah
Michael,
I have managed to build the library againts py3 and will make a pull request later.
I don't think we have ever tried it, but we would be happy to take pull requests to fix any issues with it.
Post by Iqbal Abdullah
Hello,
I've managed to compile, install and use the python esl library from
freeswitch 1.4.18, but am now wondering is there a way to get the
python esl library for python3?
I've tried changing the Makefiles in libs/esl/python to point to
python3 and made sure my dev packages are installed, but the
compilation failed.
Does the python esl module supports python3?
Iqbal Abdullah
2015-05-18 19:15:30 UTC
Permalink
If you run configure while in a py3 environment (i.e via virtualenv)
the configure will correctly detect the py3 variables.

I made the build against py3 on 1.4.18, and changes need to be done at
3 places though, after running configure above.

1) libs/esl/python/python-config because as it is this code is not py3
compliant. You can easily use 2to3 for this.
2) Make a slight change to the Makefile in libs/esl/python to pass the
-py3 parameter to swig instead, so it produces a py3 compliant
esl_wrap.cpp

--- a/libs/esl/python/Makefile
+++ b/libs/esl/python/Makefile
@@ -5,7 +5,7 @@ SITE_DIR=$(DESTDIR)/`python -c "from
distutils.sysconfig import get_python_lib;
all: _ESL.so

esl_wrap.cpp:
- swig -module ESL -classic -python -c++ -DMULTIPLICITY -threads
-I../src/include -o esl_wrap.cpp ../ESL.i
+ swig -module ESL -py3 -python -c++ -DMULTIPLICITY -threads
-I../src/include -o esl_wrap.cpp ../ESL.i

esl_wrap.o: esl_wrap.cpp
$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) -c
esl_wrap.cpp -o esl_wrap.o

3) Finally, I'm not sure if this is needed for all environment (mine is
Ubuntu 14.04 LTS x86_64) but I made a slight change to the
libs/esl/python/python-config after putting it through 2to3:

elif opt in ('--libs', '--ldflags'):
libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
- libs.append('-lpython'+pyver)
+ if pyver[0] == "3":
+ libs.append('-lpython'+pyver+'m')
+ else:
+ libs.append('-lpython'+pyver)

In my environment, the python3 library is called libpython3.4m, so I
Post by Michael Jerris
we will need some way that uses configure to detect the right python, and
builds against old and new python.
Michael,
I have managed to build the library againts py3 and will make a pull request later.
Post by Michael Jerris
I don't think we have ever tried it, but we would be happy to take pull
requests to fix any issues with it.
On May 16, 2015, at 10:30 AM, Iqbal Abdullah
Hello,
I've managed to compile, install and use the python esl library from
freeswitch 1.4.18, but am now wondering is there a way to get the
python esl library for python3?
I've tried changing the Makefiles in libs/esl/python to point to
python3 and made sure my dev packages are installed, but the
compilation failed.
Does the python esl module supports python3?
_________________________________________________________________________
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
***@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-***@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Michael Jerris
2015-05-18 19:31:54 UTC
Permalink
The changes will have to be done in a way where it will detect which version to build against in configure, and will still build against either, without requiring manual changes. Please submit a pull request with these changes when ready and in in a way that will not break older python.
Post by Iqbal Abdullah
If you run configure while in a py3 environment (i.e via virtualenv)
the configure will correctly detect the py3 variables.
I made the build against py3 on 1.4.18, and changes need to be done at
3 places though, after running configure above.
1) libs/esl/python/python-config because as it is this code is not py3
compliant. You can easily use 2to3 for this.
2) Make a slight change to the Makefile in libs/esl/python to pass the
-py3 parameter to swig instead, so it produces a py3 compliant
esl_wrap.cpp
--- a/libs/esl/python/Makefile
+++ b/libs/esl/python/Makefile
@@ -5,7 +5,7 @@ SITE_DIR=$(DESTDIR)/`python -c "from
distutils.sysconfig import get_python_lib;
all: _ESL.so
- swig -module ESL -classic -python -c++ -DMULTIPLICITY -threads
-I../src/include -o esl_wrap.cpp ../ESL.i
+ swig -module ESL -py3 -python -c++ -DMULTIPLICITY -threads
-I../src/include -o esl_wrap.cpp ../ESL.i
esl_wrap.o: esl_wrap.cpp
$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) -c
esl_wrap.cpp -o esl_wrap.o
3) Finally, I'm not sure if this is needed for all environment (mine is
Ubuntu 14.04 LTS x86_64) but I made a slight change to the
libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
- libs.append('-lpython'+pyver)
+ libs.append('-lpython'+pyver+'m')
+ libs.append('-lpython'+pyver)
In my environment, the python3 library is called libpython3.4m, so I
Post by Michael Jerris
we will need some way that uses configure to detect the right python, and
builds against old and new python.
Michael,
I have managed to build the library againts py3 and will make a pull request later.
Post by Michael Jerris
I don't think we have ever tried it, but we would be happy to take pull
requests to fix any issues with it.
On May 16, 2015, at 10:30 AM, Iqbal Abdullah
Hello,
I've managed to compile, install and use the python esl library from
freeswitch 1.4.18, but am now wondering is there a way to get the
python esl library for python3?
I've tried changing the Makefiles in libs/esl/python to point to
python3 and made sure my dev packages are installed, but the
compilation failed.
Does the python esl module supports python3?
_________________________________________________________________________
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_________________________________________________________________________
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
***@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-***@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

Loading...