This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner, xdegaye, yan12125
Date 2016-11-18.21:26:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479504395.69.0.761590307394.issue28740@psf.upfronthosting.co.za>
In-reply-to
Content
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 :-)
History
Date User Action Args
2016-11-18 21:26:35vstinnersetrecipients: + vstinner, xdegaye, yan12125
2016-11-18 21:26:35vstinnersetmessageid: <1479504395.69.0.761590307394.issue28740@psf.upfronthosting.co.za>
2016-11-18 21:26:35vstinnerlinkissue28740 messages
2016-11-18 21:26:35vstinnercreate