[Freeswitch-users] ESL python library for python3
Michael Jerris
mike at jerris.com
Mon May 18 23:31:54 MSD 2015
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.
> On May 18, 2015, at 3:15 PM, Iqbal Abdullah <iqbal.b.abdullah at gmail.com> wrote:
>
> 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
> had to append an "m" at the end of the library name, i.e:
>
>
> On 18 May 2015 at 12:05, Michael Jerris <mike at jerris.com> wrote:
>> we will need some way that uses configure to detect the right python, and
>> builds against old and new python.
>>
>> On May 18, 2015, at 3:00 PM, Iqbal Abdullah <iqbal.b.abdullah at gmail.com>
>> wrote:
>>
>> Michael,
>>
>> I have managed to build the library againts py3 and will make a pull request
>> later.
>>
>> On May 18, 2015 11:57 AM, "Michael Jerris" <mike at jerris.com> wrote:
>>>
>>> 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
>>>> <iqbal.b.abdullah at gmail.com> wrote:
>>>>
>>>> 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:
>> consulting at 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-users at lists.freeswitch.org
>> 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:
> consulting at 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-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users
mailing list