[Mobile-sig] python on android

Russell Keith-Magee russell at keith-magee.com
Sun Mar 1 00:35:26 CET 2015


On Sat, Feb 28, 2015 at 10:07 AM, Wes Turner <wes.turner at gmail.com> wrote:

>
>
> On Fri, Feb 27, 2015 at 6:40 PM, Russell Keith-Magee <
> russell at keith-magee.com> wrote:
>
>> [...] and, IMHO, a specific platform module for Android (as I've said
>> previously in this forum, I don't believe an Android device should identify
>> as "Linux", or iOS as "Darwin", because those identifiers are misleading on
>> mobile devices).
>>
>>
> re: sys.platform and mobile platforms
>
> iOS is not built on a Darwin kernel. Android is built on a Linux (3)
> kernel.
>
> For android, I think sys.platform="linux2" makes sense for things like
> pathlib (which, I assume, checks sys.platform) largely because *most*
> things should be linux-compatible (if mostly read-only and SELinux MAC
> controlled). Otherwise, many existing libraries would need to be
> unnecessarily patched.
>

Sure - Android is a lot more "linux-like" than iOS is "Darwin-like";
however, there are still a lot of differences. You can't assume /usr/bin is
populated with all the usual utilities, and that they are executable with
Popen, for example. My read on the situation is that os.name should return
'posix', but sys.platform is supposed to be "detailed checks for the
system’s identity" [1]

[1] https://docs.python.org/2/library/os.html

Maybe an additional sys.mobile_platform would be more helpful?
>

This is of course the other option. However, what does sys.mobile_platform
return on a desktop machine? And what about something like Ouya, which is
Android, but isn't really a "mobile" platform.

IMHO, it would still be a lot more helpful to differentiate "linux2" from
"android" at the sys.platform level. Yes, this means existing libraries etc
may need to be patched. However, I don't see that as a bad thing. Verifying
that a package actually works on mobile, rather than just assuming it will,
seems like a prudent approach to me.

However, I appreciate that this isn't a question of absolutes; it is, at
some level a judgement call, and may require a BDFL (or delegate) to make a
call.

Yours,
Russ Magee %-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/mobile-sig/attachments/20150301/0ba81e25/attachment.html>


More information about the Mobile-sig mailing list