Skip to content
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

Android: set sys.platform to android #76818

Closed
vstinner opened this issue Jan 23, 2018 · 6 comments
Closed

Android: set sys.platform to android #76818

vstinner opened this issue Jan 23, 2018 · 6 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir

Comments

@vstinner
Copy link
Member

BPO 32637
Nosy @brettcannon, @doko42, @vstinner, @pmp-p, @yan12125, @xgid
PRs
  • bpo-32637: Set sys.platform to "android" on Android #5287
  • bpo-32637: Set sys.platform to "android" on Android #5288
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-05-29.21:47:52.520>
    created_at = <Date 2018-01-23.17:16:49.050>
    labels = ['3.7', 'library']
    title = 'Android: set sys.platform to android'
    updated_at = <Date 2018-05-29.21:47:52.519>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2018-05-29.21:47:52.519>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-05-29.21:47:52.520>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2018-01-23.17:16:49.050>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32637
    keywords = ['patch']
    message_count = 6.0
    messages = ['310511', '310516', '310537', '310543', '310594', '318102']
    nosy_count = 6.0
    nosy_names = ['brett.cannon', 'doko', 'vstinner', 'pmpp', 'yan12125', 'xgdomingo']
    pr_nums = ['5287', '5288']
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue32637'
    versions = ['Python 3.7']

    @vstinner
    Copy link
    Member Author

    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.

    @vstinner vstinner added 3.7 (EOL) end of life stdlib Python modules in the Lib dir labels Jan 23, 2018
    @vstinner
    Copy link
    Member Author

    Wait, os.name is 'posix' on Android. That's fine in fact. Only sys.platform should be updated.

    @vstinner vstinner changed the title Android: set sys.platform and os.name to android Android: set sys.platform to android Jan 23, 2018
    @vstinner
    Copy link
    Member Author

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

    @vstinner
    Copy link
    Member Author

    A similar change was proposed by pmp-p on MicroPython: micropython/micropython#3564

    His use case is to use ffi module on Android (see the PR for more information), currently ffi fails to locate libraries.

    @vstinner
    Copy link
    Member Author

    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.

    @vstinner
    Copy link
    Member Author

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant