[issue28740] Add sys.getandroidapilevel()

2017-03-31 Thread Donald Stufft
Changes by Donald Stufft : -- pull_requests: +862 ___ Python tracker ___ ___

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: @Xavier: Cool, thanks for checking :-) I don't have access to an Android platform yet. -- resolution: -> fixed status: open -> closed ___ Python tracker

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Xavier de Gaye
Xavier de Gaye added the comment: Here is the output of getandroidapilevel(), a verbose run of test_sys and a run of the test suite on the Android x86 emulator API 21. All the results are as expected, the failed tests are the usual ones, BTW all of the failed tests have either a patch ready

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: > The version > 0 check was done because sysconfig.get_config_var() returns 0 > when a variable is found as '#undef' in pyconfig.h. Oh right, I see. In this case, we don't need to have a special case in sys.getandroidapilevel(). I pushed

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset be70d64bbf88 by Victor Stinner in branch 'default': Add sys.getandroidapilevel() https://hg.python.org/cpython/rev/be70d64bbf88 -- nosy: +python-dev ___ Python tracker

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Xavier de Gaye
Xavier de Gaye added the comment: > getandroidapilevel-3.patch: Updated version of getandroidapilevel.patch: > replace "runtime" with "build time" in the doc :-) Remove also "version > 0" > check in support/__init__.py. LGTM > About the version > 0 check: would it make sense to add the check

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Sorry for mixing different issues and proposing bad alternatives. My last hope is that someone looks into lemburg's msg281253: "I don't think the sys module is the right place to put the API, since it doesn't have anything to do with the Python system

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Xavier de Gaye
Xavier de Gaye added the comment: @Chi Hsuan Yen And please, let us not waste any more time on lost battles, this suggestion of using sys.implementation has already been rejected at issue 27442 (see msg269748) as you must know since you were involved in the discussion there. --

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Xavier de Gaye
Xavier de Gaye added the comment: > How about renaming sys.implementation._multiarch to > sys.implementation.target_architecture and make it public? > sys.androidapilevel() sounds too specific to me. Please do not hijack this issue. The removal of sys.implementation._multiarch for Android is

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: How about renaming sys.implementation._multiarch to sys.implementation.target_architecture and make it public? sys.androidapilevel() sounds too specific to me. -- ___ Python tracker

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: I suggest to start to add sys.getandroidapilevel(), and then discuss how to expose (or not) the runtime version. Reminder: The first step is to have a working Python on Android. I opened this issue to fix the issue #28596. Getting the runtime version is a new

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: getandroidapilevel-3.patch: Updated version of getandroidapilevel.patch: replace "runtime" with "build time" in the doc :-) Remove also "version > 0" check in support/__init__.py. About the version > 0 check: would it make sense to add the check in

[issue28740] Add sys.getandroidapilevel()

2016-11-21 Thread Xavier de Gaye
Xavier de Gaye added the comment: I agree with Marc-Andre, Windows has sys.getwindowsversion() returning system information for the Windows version, and a platform.win32_ver() returning additional version information from the Registry obtained at run time. So it is consistent to add the

[issue28740] Add sys.getandroidapilevel()

2016-11-20 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 20.11.2016 00:59, STINNER Victor wrote: > > STINNER Victor added the comment: > >> I think we must use the reliable build time Android API level and > implement sys.getandroidapilevel() (Victor patch) for knowing, in the > standard library, whether we

[issue28740] Add sys.getandroidapilevel()

2016-11-19 Thread STINNER Victor
STINNER Victor added the comment: > I think we must use the reliable build time Android API level and implement sys.getandroidapilevel() (Victor patch) for knowing, in the standard library, whether we are running on an Android platform, and provide a best effort platform.android_ver() for the

[issue28740] Add sys.getandroidapilevel()

2016-11-19 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Both sys.androidapilevel() and platform.android_ver() return information about Android's API level. I guess that would be confusing so I hope to get them unified. Techinically it won't be a problem as Chromium is still using it (in a even dirty way) and the

[issue28740] Add sys.getandroidapilevel()

2016-11-19 Thread Xavier de Gaye
Xavier de Gaye added the comment: The build time Android API level is also a valuable information to Python users (application developers), it may be used at installation time or to detect a version mismatch. -- ___ Python tracker

[issue28740] Add sys.getandroidapilevel()

2016-11-19 Thread Xavier de Gaye
Xavier de Gaye added the comment: __system_property_get() is not a public API, see Android bug report [1]. In this stackoverflow question, an Android developer confirms this point and suggests to use the file /system/build.prop instead, noting however that "build.prop isn't guaranteed to be

[issue28740] Add sys.getandroidapilevel()

2016-11-19 Thread STINNER Victor
STINNER Victor added the comment: I didn't know that there are build and runtime versions. If the runtime version is available, it should be preferred. Hum, maybe its better to expose the __system_property_get() function in the os module, something similar to os.confstr()?

[issue28740] Add sys.getandroidapilevel()

2016-11-19 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: I translate the Python version at issue26855 to C. Quite new to the C API, hope I'm doing it right :) Codes only. Docs and tests later sys.getwindowsversion() uses named tuples. Is there a similar need for Android or just plain tuples are fine? --

[issue28740] Add sys.getandroidapilevel()

2016-11-19 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Maybe time to re-implement android_ver() in issue26855 in C. -- ___ Python tracker ___

[issue28740] Add sys.getandroidapilevel()

2016-11-18 Thread Xavier de Gaye
Xavier de Gaye added the comment: Patch tested with success on the android-24 emulator. -- ___ Python tracker ___

[issue28740] Add sys.getandroidapilevel()

2016-11-18 Thread Xavier de Gaye
Xavier de Gaye added the comment: > I proposed to add a new function to the sys module: sys.getandroidapilevel() This would also help fixing the long standing issue 16255, and possibly also issue 16353. -- ___ Python tracker

[issue28740] Add sys.getandroidapilevel()

2016-11-18 Thread STINNER Victor
STINNER Victor added the comment: Ah, I wrote a patch to implement the function. I used ANDROID_API_LEVEL from pyconfig.h. I chose to simply return an integer. I don't know if it's the most future-proof API :-) -- keywords: +patch Added file:

[issue28740] Add sys.getandroidapilevel()

2016-11-18 Thread STINNER Victor
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