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 <rep...@bugs.python.org> <http://bugs.python.org/issue26855> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com