[Mobile-sig] python on android

Wes Turner wes.turner at gmail.com
Sun Mar 1 02:38:39 CET 2015


On Sat, Feb 28, 2015 at 5:35 PM, Russell Keith-Magee <
russell at keith-magee.com> wrote:

>
> 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.
>

The existence of executables in $PATH is not a fair assumption from either
os.name or sys.platform.
(see: distutils.spawn.find_executable (!), sarge).


> 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.
>

Good point.


>
> 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.
>

This is a hard question. Without reasonable build environments, it's very
unlikely that anyone will have the resources to test on these other
platforms (and architectures); so things could be arbitrarily broken when
they would otherwise work. Arguably, this is the responsibility of
end-developers.

 I think android sys.platform should read as linux2 (even for GNU/Linux
kernel 4.0+); but have no expertise with iOS.


>
> 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.
>
>
Again, reasonable development build environments (for CI) would be helpful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/mobile-sig/attachments/20150228/997234bd/attachment.html>


More information about the Mobile-sig mailing list