-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add Pillow Recipe #1339
Add Pillow Recipe #1339
Conversation
Looks good to me, but I'll let @AndreMiras check it since I think he's followed the development more. About setuptools, it should be fine to update the version in the recipe, as long as it does work (which it sounds like it does). About libcutils, I don't know what this is used for, do things seem to work fine without it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind fixing the small code style things travis has caught via flake8? You can ignore the android module import, I will fix that separately (edit: now fixed in master).
3feb7ff
to
4236fa7
Compare
Thank you very much for the pull request @krinnewitz it's looking good so far. I'll give it a try with https://github.com/kivy-garden/garden.zbarcam later tonight and keep you posted. |
Thanks guys. I have resolved the problems detected by flake8. Regarding Regarding libjpeg: I was able to load a jpeg image without |
Great. It would still be fine to update the recipe version if you tested the newer one and it worked, there recipe exists more for internal reasons than because the version should matter. About libcutils, I guess let's leave it for now but maybe leave a comment about it in the recipe. If someone really wants to use pillow with python2, they can look into it. |
3534384
to
26d77c9
Compare
Ok, I have added another commit which upgrades it to 40.0.0.
Actually, the problem should occur for any app using |
Once you want to have me test this with my |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've started playing with it and Python2.
First thing I noticed is the recipe would not be picked up if requirements is written lower case. Instead of that the one from pypi will be picked up and installed without cross compiling, resulting in the usual site-packages/PIL/_imaging.so" is 64-bit instead of 32-bit
error.
I don't know if it's something we can/should tackle in this PR, but it's worth to mention.
@@ -0,0 +1,13 @@ | |||
diff --git a/src/PIL/__init__.py b/src/PIL/__init__.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, FWIW I would reference the upstream bug python-pillow/Pillow#3231
@AndreMiras Good catch about the case sensitivity. I think this recipe should definitely use lower case, both for consistency with the other recipes and because if that's what the pypi entry uses then we should probably match anyway. Maybe p4a should always ignore case for recipes, that would probably be a good idea (although usually not that important). |
The official PyPI package appears to be named However, it seems |
In that case it seems clear that p4a should not be case sensitive when looking for recipes, but that's a separate issue. I'd encourage this recipe to use lower case for consistency with p4a in general, but it isn't a blocking issue as far as I'm concerned. |
Yes that's probably something we should fix in p4a to ignore the case and then have all recipe to be lowercase in the file system. But that's something we could probably tackle later. So far I was able to compile Pillow for a Python2 project after fixing the include path. However garden.zbarcam doesn't seem to catch qrcodes anymore. That might be for some unrelated reasons I'll dig later. |
All the (official) tutorials name it |
I'm facing xcamera issues to play with garden.zbarcam, but the recipe looks good overall @krinnewitz ! @Jonast actually the idea is just to ignore the case, not to decide whether it should be lower or upper. The thing is currently if you put |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't consider my comment being blockers, this recipe is already an improvement considering what we already (don't) have. So I would be happy to merge it.
ndk_dir = self.ctx.ndk_platform | ||
ndk_lib_dir = join(ndk_dir, 'usr', 'lib') | ||
ndk_include_dir = (join(self.ctx.ndk_dir, 'sysroot', 'usr', 'include') | ||
if py_ver == '2.7' else join(ndk_dir, 'usr', 'include')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the zlib.h
include actually deployed here on your Python 2.7 installation? Because on mine it's seems that join(ndk_dir, 'usr', 'include'))
doesn't exist, while the former does (join(self.ctx.ndk_dir, 'sysroot', 'usr', 'include')
.
So basically when running recipe on Python2, the ZLIB_ROOT
would contain the following:
/home/andre/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm/usr/lib|/home/andre/.buildozer/android/platform/android-ndk-r9c/sysroot/usr/include
The lib directory seems fine:
ls /home/andre/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm/usr/lib/
crtbegin_dynamic.o crtbegin_so.o crtbegin_static.o crtend_android.o crtend_so.o libandroid.so libc.a libc.so libdl.so libEGL.so libGLESv1_CM.so libGLESv2.so libGLESv3.so libjnigraphics.so liblog.so libm.a libm_hard.a libm.so libOpenMAXAL.so libOpenSLES.so libstdc++.a libstdc++.so libthread_db.so libz.so rs
However the include is not:
ls /home/andre/.buildozer/android/platform/android-ndk-r9c/sysroot/usr/include
ls: cannot access '/home/andre/.buildozer/android/platform/android-ndk-r9c/sysroot/usr/include': No such file or directory
But if I skip line 33 and set the include as ndk_include_dir = (join(self.ctx.ndk_dir, 'sysroot', 'usr', 'include')
then it contains the includes:
ls /home/andre/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm/usr/include/
alloca.h asm byteswap.h dlfcn.h endian.h fcntl.h fnmatch.h GLES grp.h KHR limits.h locale.h math.h mtd netinet OMXAL poll.h regex.h sched.h sgtty.h SLES stdlib.h sys termios.h time.h utime.h wctype.h
android asm-generic ctype.h EGL err.h features.h fts.h GLES2 inttypes.h lastlog.h link.h machine memory.h net netpacket pathconf.h pthread.h resolv.h semaphore.h sha1.h stdint.h string.h syslog.h thread_db.h unistd.h utmp.h zconf.h
arpa assert.h dirent.h elf.h errno.h fenv.h getopt.h GLES3 jni.h libgen.h linux malloc.h mntent.h netdb.h nsswitch.h paths.h pwd.h rs setjmp.h signal.h stdio.h strings.h termio.h time64.h util.h wchar.h zlib.h
@inclement the PEP8 comment you made #1339 (review) was addressed, can you approve and merge? The merging is currently being blocked with that comment. |
Thanks for the merge @inclement and thanks for your work @krinnewitz @Jonast yes please give it a try #1339 (comment)
|
Edit: ignore comment I'm a confused person 😄 Yea, I was just suggesting making it lowercase "to ignore the case" isn't that obvious from a user perspective: Once ignoring the case works, this is all irrelevant anyway, of course |
Also, amazing work! 🎉 🎉 🎈 👍 ❤️ I'll go test |
But what if people put |
Well, what if they have |
That's exactly why we suggest to totally ignore the case in p4a code base so one case or the other would never fail 😄 |
Oh, right. I was just talking about the transition up to then. Sorry for the misunderstanding! Edit: Yea scrolling up I totally misread where the discussion was going 😆 sorry |
I just tested the recipe with |
Thank you all for reviewing, merging, and testing so fast! |
This patch adds a new recipe for Pillow. There already is a recipe for PIL, but PIL does not support python3.
This new recipe should work with
python3crystax
as well as withpython2
. However, withpython2
, there are the following issues:setuptools
provides an older version ofsetuptools
, which is too old for Pillow. This can be circumvented by specifyingsetuptools==40.0.0
when building an APK. I am not sure if it is possible to specify a minimum version for dependencies inside recipes.jpeg
recipe which requireslibcutils
. I resolved it locally by removinglibcutils
frompythonforandroid/recipes/jpeg/build-static.patch
.With
python3crystax
, there should be no issues.This PR addresses #1114 and #1326.