<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#330033">
    <div class="moz-cite-prefix">On 7/31/2014 5:59 PM, Shiz wrote:<br>
    </div>
    <blockquote cite="mid:8ECB8F3D-E512-43F7-913F-3E5EC2154D27@shiz.me"
      type="cite">
      <pre wrap="">Hi folks,

I’m working on porting CPython to the Android platform, and while making decent progress, I’m currently stuck at a higher-level issue than adding #ifdefs for __ANDROID__ to C extension modules.

The idea is, not only CPython extension modules have some assumptions that don’t seem to fit Android’s mold, some default Python-written modules do as well. However, whereas CPython extensions can trivially check if we’re building for Android by checking the __ANDROID__ compiler macro, Python modules can do no such check, and are left wondering how to figure out if the platform they are currently running on is an Android one. To my knowledge there is no reliable way to detect if one is using Android as a vehicle for their journey using any other way.

Now, the main question is: what would be the best way to ‘expose’ the indication that Android is being ran on to Python-living modules? My own thought was to add sys.getlinuxuserland(), or platform.linux_userland(), in similar vein to sys.getwindowsversion() and platform.linux_distribution(), which could return information about the userland of running CPython instance, instead of knowing merely the kernel and the distribution.</pre>
    </blockquote>
    <br>
    I've no idea what you mean by "userland" in your suggestions above
    or below, but doesn't the Android environment qualify as a
    (multi-versioned) platform independently of its host OS? Seems I've
    read about an Android reimplementation for Windows, for example. As
    long as all the services expected by Android are faithfully
    produced, the host OS may be irrelevant to an Android application...
    in which case, I would think/propose/suggest the platform name
    should change from win32 or linux to Android (and the Android
    version be reflected in version parts).<br>
    <br>
    <blockquote cite="mid:8ECB8F3D-E512-43F7-913F-3E5EC2154D27@shiz.me"
      type="cite">
      <pre wrap="">This way, code could trivially check if it ran on the GNU(+associates) userland, or under a BSD-ish userland, or Android… and adjust its behaviour accordingly.

I would be delighted to hear comments on this proposal, or better yet, alternative solutions. :)

Kind regards,
Shiz

P.S.: I am well aware that Android might as well never be officially supported in CPython. In that case, consider this a thought experiment of how it /would/ be handled. :)</pre>
    </blockquote>
    <br>
    Is your P.S. suggestive that you would not be willing to support
    your port for use by others?  Of course, until it is somewhat
    complete, it is hard to know how complete and compatible it can be.<br>
  </body>
</html>