Author vstinner
Recipients vstinner, xdegaye, yan12125
Date 2016-11-18.21:26:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:

I'm sorry, I don't have access to an Android development platform, so I let someone else implement it :-)
Date User Action Args
2016-11-18 21:26:35vstinnersetrecipients: + vstinner, xdegaye, yan12125
2016-11-18 21:26:35vstinnersetmessageid: <>
2016-11-18 21:26:35vstinnerlinkissue28740 messages
2016-11-18 21:26:35vstinnercreate