[Python-ideas] Adding iOS/Android support to Python

Antoine Pitrou solipsis at pitrou.net
Sat Oct 25 17:42:50 CEST 2014


On Sat, 25 Oct 2014 10:20:05 +0800
Russell Keith-Magee <russell at keith-magee.com>
wrote:
> 
> In particular, there are four areas where I can see changes required:
> 
>  1) At least 2 new sys.platform definitions - "ios" and "android" (a third
> "iossimulator" platform might also be needed - the iOS simulator has enough
> differences that it can be helpful to be able to identify the platform)

"ios" and "android" sound ok to me. A specific platform for the
simulator sounds wrong, though. If it simulates iOS, it should
certainly simulate its platform identification.

>  2) Modifications to the build system to support cross-platform builds for
> mobile - AFAICT, cross platform builds currently only work on Linux and
> require readelf; iOS libraries can only be built on Mac, and building
> Android libraries don't require readelf (AFAICT).

I don't know anything about cross-compiling. The best is that you try
to whip up a patch and submit it on the tracker.

Also, I suggest you tackle one system at a time. It will be easier to
review and accept patches if they target only Android or only iOS, as
opposed to both at the same time.

>  3) Disabling certain modules on mobile platforms. Supporting modules like
> linuxaudiodev, ossaudiodev, readline, curses, idle and tkinter on mobile
> platforms doesn't make much sense; modules likes bsddb and bz2 are
> difficult to support due to library dependencies; and the need for modules
> like multiprocessing is arguable (and difficult to support on mobile).

Special support for this isn't necessary. If setup.py doesn't find the
necessary external dependencies, it will skip building those modules.
If OTOH those modules are built, you can remove them when creating your
installer (I imagine you won't use "setup.py install" on those
platforms).

> I have no idea how to tackle 4. To create a complete iOS build, you have to
> do at least 4 complete Python builds - a native system build (so you can
> run Python scripts that are part of the build), an i386 build (for the
> simulator), an armv7 build, and an arm64 build - and then the build
> products of the last three need to be combined into a single framework
> directory.

No idea. Perhaps start by tackling the first 3 points. When you arrive
at 4, open an issue and our resident Mac experts can help you :-)

> I'm also not clear how to tackle the testing and CI problems. Since you
> can't run iOS code on a non-iOS machine, it isn't entirely clear to me what
> an acceptance test would look like for a mobile build.

We don't have acceptance tests for all platforms. You'll have to check
that Python still builds on a regular basis.

Regards

Antoine.




More information about the Python-ideas mailing list