Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP [mod_python, ESL] Add Python3 support. #191

Closed
wants to merge 2 commits into from

Conversation

mochouinard
Copy link
Contributor

This is an initial commit for mod_python3 support. A few of the changes I've done here would also be good for mod_python, but decided to wait before this is accepted to back port it.

Python 2.7 is going EOF in a few days... So it about time we move to Python3.

I also have a patch to get ESL python3 to compile.

This is regarding support ticket : #186

@mochouinard mochouinard force-pushed the mod_python3 branch 2 times, most recently from bf13003 to 17421c7 Compare December 26, 2019 08:32
@mochouinard
Copy link
Contributor Author

I've added the ESL patch in there as a seperate commit as well..

@mochouinard mochouinard changed the title [mod_python3] Initial Commit of mod_python3 [mod_python3] Initial Commit of mod_python3 & Python3 support in ESL Dec 26, 2019
@mochouinard
Copy link
Contributor Author

I think I wasn't clear in the first message... the mod_python3 is just an initial commit... but it doesn't work... It just compile. I changed a few function name that have to be reviewed with the correct one, and commented out a few things.

the patch for ESL integration does work and I do use it just fine though.

mjerris added a commit that referenced this pull request Jan 9, 2020
…eeswitch-advantage:bugfix/FS-10801-Fix-core-mod-preload to v1.8-fsa

* commit '64af8df8f43aba409245df9f3513d08f3344fd69':
  FS-10801: [Core] Use right order when loading core modules.
  Revert "FS-10801: [core] temporarily disable db interface preload"
@mneirynck
Copy link

Any idea when this might get integrated and python3 gets the default requirement?

@mochouinard
Copy link
Contributor Author

We must first finish the module ! It is not currently functionning.

@mochouinard
Copy link
Contributor Author

This this latest patch, I merged the changes with mod_python. It not super pretty and final yet, but you may give it a try !

@zuheo23
Copy link

zuheo23 commented Dec 8, 2020

Thanks for the patch. i managed to compile and run a print statement (def fsapi) from fs_cli using your mod_python patch without the changes in "configure.ac". May be I applied the patch wrongly.
wget https://github...../....191.patch
git am ....191.patch
doesn't work
so I applied manually line by line.
Will keep testing by writing more modules

@Ajinkya009
Copy link

Ajinkya009 commented Feb 8, 2021

Thank you for the patch @mochouinard. We manually entered all the changes mentioned in the patch and then built the library. But when we try to import it, we get following errors:

ImportError                               Traceback (most recent call last)
<ipython-input-2-a536c87db710> in <module>
----> 1 from ESL import ESLconnection

freeswitch/ESL/__init__.py in <module>
----> 1 from .ESL import ESLconnection

~/freeswitch/ESL/ESL.py in <module>
     26                 fp.close()
     27             return _mod
---> 28     _ESL = swig_import_helper()
     29     del swig_import_helper
     30 else:

~/freeswitch/ESL/ESL.py in swig_import_helper()
     22         if fp is not None:
     23             try:
---> 24                 _mod = imp.load_module('_ESL', fp, pathname, description)
     25             finally:
     26                 fp.close()

~/.venv/ajinkya/lib/python3.7/imp.py in load_module(name, file, filename, details)
    240                 return load_dynamic(name, filename, opened_file)
    241         else:
--> 242             return load_dynamic(name, filename, file)
    243     elif type_ == PKG_DIRECTORY:
    244         return load_package(name, filename)

~/.venv/ajinkya/lib/python3.7/imp.py in load_dynamic(name, path, file)
    340         spec = importlib.machinery.ModuleSpec(
    341             name=name, loader=loader, origin=path)
--> 342         return _load(spec)
    343
    344 else:

ImportError: dynamic module does not define module export function (PyInit__ESL)

System information:
OS: Debian 10
Python: 3.7.9
Freeswitch: 1.10.5

@Ajinkya009
Copy link

Ajinkya009 commented Feb 17, 2021

Thank you for the patch @mochouinard. We manually entered all the changes mentioned in the patch and then built the library. But when we try to import it, we get following errors:

ImportError                               Traceback (most recent call last)
<ipython-input-2-a536c87db710> in <module>
----> 1 from ESL import ESLconnection

freeswitch/ESL/__init__.py in <module>
----> 1 from .ESL import ESLconnection

~/freeswitch/ESL/ESL.py in <module>
     26                 fp.close()
     27             return _mod
---> 28     _ESL = swig_import_helper()
     29     del swig_import_helper
     30 else:

~/freeswitch/ESL/ESL.py in swig_import_helper()
     22         if fp is not None:
     23             try:
---> 24                 _mod = imp.load_module('_ESL', fp, pathname, description)
     25             finally:
     26                 fp.close()

~/.venv/ajinkya/lib/python3.7/imp.py in load_module(name, file, filename, details)
    240                 return load_dynamic(name, filename, opened_file)
    241         else:
--> 242             return load_dynamic(name, filename, file)
    243     elif type_ == PKG_DIRECTORY:
    244         return load_package(name, filename)

~/.venv/ajinkya/lib/python3.7/imp.py in load_dynamic(name, path, file)
    340         spec = importlib.machinery.ModuleSpec(
    341             name=name, loader=loader, origin=path)
--> 342         return _load(spec)
    343
    344 else:

ImportError: dynamic module does not define module export function (PyInit__ESL)

System information:
OS: Debian 10
Python: 3.7.9
Freeswitch: 1.10.5

If anyone else comes across this issue, please check if python3-dev package is installed. We were able to fix this issue by installing the package.

@mjerris
Copy link
Collaborator

mjerris commented Feb 19, 2021

make swigall should fix those issues I think, give it a try after you apply the patch

@MaartenUreel
Copy link

Any update on this? Will it be merged in FS?

@mdemille
Copy link

mdemille commented Jun 7, 2021

Been 3 months, commenting for a bump.

Any update on getting this merged? It's going to become quite the problem when OS's start dropping python2 support...

@andywolk
Copy link
Contributor

andywolk commented Jun 7, 2021

Please resolve conflicts

…re with flag --with-python=/usr/bin/python3 (Or the location of your python3 interpreter)
You can now do make py3mod inside libs/esl.  If you want to install python2 and python3 support, you woud have to do a make clean of the libs/esl/python folder between make / install
@andywolk andywolk changed the title [mod_python3] Initial Commit of mod_python3 & Python3 support in ESL [mod_python, ESL] Add Python3 support. Aug 24, 2021
@andywolk andywolk self-requested a review August 24, 2021 15:15
@andywolk andywolk requested review from andywolk and briankwest and removed request for briankwest August 24, 2021 18:06
@andywolk andywolk requested review from briankwest and removed request for briankwest August 24, 2021 18:41
@andywolk andywolk changed the title [mod_python, ESL] Add Python3 support. WIP [mod_python, ESL] Add Python3 support. Aug 24, 2021
@MaartenUreel
Copy link

@andywolk is this expected to be merged soon? I see that all the checks have passed and that you have approved it earlier.

We are very eager to start testing it out :)

@andywolk
Copy link
Contributor

Thank you for your PR. Unfortunatelly there were much more work than just taking this as is. I am closing this as we finally added Python3 support. See latest commits in master.

@andywolk andywolk closed this Oct 14, 2021
@MaartenUreel
Copy link

Great news, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants