[New-bugs-announce] [issue28740] Add sys.getandroidapilevel()

STINNER Victor report at bugs.python.org
Fri Nov 18 16:26:35 EST 2016


New submission from STINNER Victor:

Android slowly becomes a first-citizen class platform in CPython thanks to Xavier de Gaye and other motivated developers, thanks to all of them :-)

To fix the issue #28596, we need a function to check if we are running Android. Chi Hsuan Yen proposed to use sysconfig to get the new ANDROID_API_LEVEL configuration option:

+        if sysconfig.get_config_var('ANDROID_API_LEVEL'):

But I asked to avoid sysconfig to reduce imports at Python startup (especially when the site module is not loaded). I proposed to add a new function to the sys module: sys.getandroidapilevel().

sys.getandroidapilevel() would only be available on Android, as  sys.getwindowsversion() is only available on Windows, and would return ANDROID_API_LEVEL as an integer.

I'm not sure about the type: should we use a string? A tuple of integers like sys.version_info?

sys.getwindowsversion() returns a named tuple:
https://docs.python.org/dev/library/sys.html#sys.getwindowsversion

I'm sorry, I don't have access to an Android development platform, so I let someone else implement it :-)

----------
messages: 281169
nosy: Chi Hsuan Yen, haypo, xdegaye
priority: normal
severity: normal
status: open
title: Add sys.getandroidapilevel()
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28740>
_______________________________________


More information about the New-bugs-announce mailing list