Skip to content

Add support for ctypes to python3's recipe#1463

Closed
opacam wants to merge 2 commits into
kivy:masterfrom
opacam:python3-libffi
Closed

Add support for ctypes to python3's recipe#1463
opacam wants to merge 2 commits into
kivy:masterfrom
opacam:python3-libffi

Conversation

@opacam

@opacam opacam commented Nov 17, 2018

Copy link
Copy Markdown
Member

Should be mentioned that the current test app for python3 has been modified by adding libffi to the requirements because the ui for the app has some button to test the ctypes module.

References: This commit partially fixes some of the points mentioned in issue number #1455

Should be mentioned that the current test app for python3 has been modified by adding libffi to the requirements because the ui for the app has some button to test the ctypes module.

References: This commit partially fixes some of the points mentioned in issue number kivy#1455
KeyWeeUsr
KeyWeeUsr previously approved these changes Nov 17, 2018

@KeyWeeUsr KeyWeeUsr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems quite clean, looks good. I presume you've tested the final APK on your device? :)

Kind of nitpicking here, but if I were a linter, I'd brag about https://github.com/kivy/python-for-android/pull/1463/files#diff-62af0574da035ee296803d8d5f97ef79R76 :D

@opacam

opacam commented Nov 17, 2018

Copy link
Copy Markdown
Member Author

I presume you've tested the final APK on your device? :)

Yes 😉

@KeyWeeUsr

Copy link
Copy Markdown
Contributor

Ah, so it does brag after all 😄 https://travis-ci.org/kivy/python-for-android/jobs/456426763#L526
Please remove that single space, so that the build is green 👍

@AndreMiras AndreMiras left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also looks good to me. Still I'd like @inclement to take a look since he worked on python3 recently.
In the meantime do you mind pleasing the linter (from Travis). The error was:

pythonforandroid/recipes/python3/__init__.py:76:36: E127 continuation line over-indented for visual indent

For info you can run it locally with tox.

@opacam

opacam commented Nov 17, 2018

Copy link
Copy Markdown
Member Author

One of the tests is failing, I suspect that affected by issue #1454

@AndreMiras

Copy link
Copy Markdown
Member

Thanks!
Yep indeed for the failing test, you're right we can ignore that one. It's not exactly what's described #1454 but yes I've created #1464 for it.

@inclement inclement left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems great, thanks, just some minor comments.
Would you mind also adding a brief note about this to the documentation, in the build-options page under python3? Just something like "ctypes is not included automatically, if you would like to use it then add libffi to your requirements, e.g. --requirements=kivy,libffi,python3.".

ArrayList<String> libsList = new ArrayList<String>();
addLibraryIfExists(libsList, "crystax", libsDir);
addLibraryIfExists(libsList, "sqlite3", libsDir);
addLibraryIfExists(libsList, "ffi", libsDir);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we need a more automatic way to add library loads here, unless - is it essential to load this library in this way, or does dynamic access work?
That doesn't need to hold up this PR though.

@opacam opacam Nov 18, 2018

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested without these line and dynamic access seems to work, thanks! :)
I correct myself ( I suppose that I did not update the test app on my device when removed those lines... 😅), another test with a clean branch and without modifying these line lead me to ctypes import error, so...I think these line is required because the ctypes module gets build in python modules...plus seems logical that we need these line, as we do with sqlite3 and openssl (cause are external dependencies for python)...anyway...I'm doing another test re-adding these lines again...which should make it work...

Update:
The test application successfully import ctypes with these line...crash without it.

Comment thread pythonforandroid/recipes/python3/__init__.py
Comment thread pythonforandroid/recipes/python3/__init__.py
Comment thread pythonforandroid/recipes/python3/__init__.py
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.

4 participants