classification
Title: Android: set sys.platform to android
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, doko, pmpp, vstinner, xgdomingo, yan12125
Priority: normal Keywords: patch

Created on 2018-01-23 17:16 by vstinner, last changed 2018-05-29 21:47 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5287 closed vstinner, 2018-01-23 21:08
PR 5288 closed vstinner, 2018-01-23 23:55
Messages (6)
msg310511 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-01-23 17:16
Currently, sys.platform and os.name are equal to 'linux' on Android. While Android uses the Linux kernel, the operating system is not a regular Linux. The libc (bionic) is very different than the regular glibc, the filesystem is organized very differently, etc.

I propose to change sys.platform and os.name to 'android' when running on Android.
msg310516 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-01-23 17:38
Wait, os.name is 'posix' on Android. That's fine in fact. Only sys.platform should be updated.
msg310537 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-01-24 00:12
The idea was first discussed on python-dev:

https://mail.python.org/pipermail/python-dev/2018-January/151874.html

me: "It seems like sys.platform == 'android' would be more appropriate
since Android is not Linux: different libc, different filesystems,
etc."

https://mail.python.org/pipermail/python-dev/2018-January/151887.html

Brett Cannon: "I've had a similar thought myself.".
msg310543 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-01-24 00:42
A similar change was proposed by pmp-p on MicroPython: https://github.com/micropython/micropython/pull/3564

His use case is to use ffi module on Android (see the PR for more information), currently ffi fails to locate libraries.
msg310594 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-01-24 13:37
I propose to leave MACHDEP unchanged: keep MACHDEP="linux". Can it create inconsistencies? Is it an issue in practice?

My short term goal is to use sys.platform == 'android' has the reference test to check if we are running on Android.
msg318102 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-29 21:47
Sadly, I failed to find anyone to help me on this issue and I lost interest on supporting Android, so I just close the issue. Sorry.
History
Date User Action Args
2018-05-29 21:47:52vstinnersetstatus: open -> closed
resolution: out of date
messages: + msg318102

stage: patch review -> resolved
2018-01-31 04:24:57xgdomingosetnosy: + xgdomingo
2018-01-25 12:38:38xdegayesetnosy: - xdegaye
2018-01-24 13:37:33vstinnersetmessages: + msg310594
2018-01-24 00:44:12vstinnersetnosy: + yan12125
2018-01-24 00:42:58vstinnersetmessages: + msg310543
2018-01-24 00:38:05vstinnersetnosy: + doko
2018-01-24 00:12:46vstinnersetnosy: + brett.cannon
2018-01-24 00:12:39vstinnersetmessages: + msg310537
2018-01-23 23:55:21vstinnersetpull_requests: + pull_request5134
2018-01-23 21:08:03vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request5133
2018-01-23 19:39:08pmppsetnosy: + pmpp
2018-01-23 17:38:53vstinnersetmessages: + msg310516
title: Android: set sys.platform and os.name to android -> Android: set sys.platform to android
2018-01-23 17:16:49vstinnercreate