From 3a90d693ad4b21dc14671235860edbe717a80201 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 24 Jan 2018 00:52:27 +0100 Subject: [PATCH 1/2] bpo-32637: Set sys.platform to "android" on Android --- Doc/library/sys.rst | 5 +++++ .../next/Library/2018-01-24-00-52-55.bpo-32637.ntAPTa.rst | 1 + Python/getplatform.c | 6 ++++++ 3 files changed, 12 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2018-01-24-00-52-55.bpo-32637.ntAPTa.rst diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 54281a3f9a0c155..fa37d97a1531e17 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -999,8 +999,13 @@ always available. Windows ``'win32'`` Windows/Cygwin ``'cygwin'`` Mac OS X ``'darwin'`` + Android ``'android'`` ================ =========================== + .. versionchanged:: 3.7 + On Android, :attr:`sys.platform` is now equal to ``"android"`` rather + than ``'linux'``. + .. versionchanged:: 3.3 On Linux, :attr:`sys.platform` doesn't contain the major version anymore. It is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``. Since diff --git a/Misc/NEWS.d/next/Library/2018-01-24-00-52-55.bpo-32637.ntAPTa.rst b/Misc/NEWS.d/next/Library/2018-01-24-00-52-55.bpo-32637.ntAPTa.rst new file mode 100644 index 000000000000000..e1a346b875851b5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-01-24-00-52-55.bpo-32637.ntAPTa.rst @@ -0,0 +1 @@ +Set sys.platform to "android" on Android. diff --git a/Python/getplatform.c b/Python/getplatform.c index 81a0f7ac5378bd5..cbacf08ee562503 100644 --- a/Python/getplatform.c +++ b/Python/getplatform.c @@ -5,6 +5,12 @@ #define PLATFORM "unknown" #endif +/* bpo-32637: Force sys.platform == "android" on Android */ +#ifdef __ANDROID__ +# undef PLATFORM +# define "android" +#endif + const char * Py_GetPlatform(void) { From 0fe850b412f5a277de7912264c92d0326e335798 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 24 Jan 2018 00:56:43 +0100 Subject: [PATCH 2/2] Fix compilation --- Python/getplatform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/getplatform.c b/Python/getplatform.c index cbacf08ee562503..f0408420444d9f5 100644 --- a/Python/getplatform.c +++ b/Python/getplatform.c @@ -8,7 +8,7 @@ /* bpo-32637: Force sys.platform == "android" on Android */ #ifdef __ANDROID__ # undef PLATFORM -# define "android" +# define PLATFORM "android" #endif const char *