[issue26855] add platform.android_ver() for android

2016-04-27 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

I have a WIP patch. [1] It's based on Shiz's patch [2].

[1] 
https://github.com/yan12125/python3-android/blob/cpython-hg/mk/python/android-misc.patch
[2] 
https://github.com/rave-engine/python3-android/blob/9bb6420317922c07df405315eea040f9301f7eca/mk/python/3.4.3/python-3.4.3-android-misc.patch

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26855] add platform.android_ver() for android

2016-04-27 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Some screenshots showing different file contents:

 * 
http://www1-lw.xda-cdn.com/files/2013/12/tweak-your-samsung-galaxy-s3s-performance-with-these-build-prop-android-hacks.w654.jpg
 * 
http://media.apcmag.com/wp-content/uploads/sites/20/2014/04/buildprop-text-file.jpg
 * http://i.imgur.com/hZXQaX9.png

I think exposing `codename` and `incremental` may also make sense to get a 
complete picture.

`ro.product` also has a lot of useful entries which could be used for some of 
the other platform APIs such as uname().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26855] add platform.android_ver() for android

2016-04-27 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

If the file is guaranteed to exist on most modern Android platforms, this 
sounds like a good approach.

Perhaps you could add support to fallback to running getprop instead, if the 
file doesn't exist or cannot be parsed ?!

--
nosy: +lemburg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26855] add platform.android_ver() for android

2016-04-27 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Isn't this macro used in compile time? I thought android_ver() aims to check 
runtime versions.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26855] add platform.android_ver() for android

2016-04-27 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The android/api-level.h header exists at all the android API levels and define 
__ANDROID_API__ as, for example at level 21:

#define __ANDROID_API__ 21

So it is possible to get the sdk version from here, and maybe forget about the 
release version.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26855] add platform.android_ver() for android

2016-04-26 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

> Also how can we be sure that the '/system/build.prop' file may be guaranteed 
> to exist on all android devices ?

This path is hard-coded in BioniC [1]. Though I can't find a document/relevant 
source codes to guarantee 'ro.build.version.release' and 'ro.build.version.sdk' 
is always in /system/build.prop

And the format of build.prop is not exactly INI. It supports 'import' clauses. 
See [2] and load_properties() function in [3]

Other options include calling `getprop` via subprocess or using C level 
function __system_property_get(). The first approach should always work. It's 
just somewhat tricky on Android 4.1 [4]. For the second option, a bad news is 
that it's a private API and was just removed from the latest NDK. Chromium has 
a workaround for that [5] and CPython may use similar approaches.

[1] 
https://android.googlesource.com/platform/bionic/+/master/libc/include/sys/_system_properties.h
[2] 
http://forum.xda-developers.com/android/general/explanation-build-prop-values-t3069341
[3] 
https://android.googlesource.com/platform/system/core/+/master/init/property_service.cpp
[4] 
https://github.com/rave-engine/python3-android/pull/10#issuecomment-159151445
[5] 
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-reviews/keQP6L9aVyU

--
nosy: +Chi Hsuan Yen

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26855] add platform.android_ver() for android

2016-04-26 Thread Roman Evstifeev

Changes by Roman Evstifeev :


--
nosy: +Roman.Evstifeev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26855] add platform.android_ver() for android

2016-04-26 Thread Xavier de Gaye

New submission from Xavier de Gaye:

The attached patch misses a test case.

Also how can we be sure that the '/system/build.prop' file may be guaranteed to 
exist on all android devices ?
It is difficult to get a reliable information on the android infrastructure 
when the information does not relate to the java libraries.

--
components: Cross-Build
files: platform.patch
keywords: patch
messages: 264277
nosy: Alex.Willmer, xdegaye
priority: normal
severity: normal
status: open
title: add platform.android_ver() for android
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42606/platform.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com