Re: [Python-Dev] Exposing the Android platform existence to Python modules
Guido van Rossum writes:
> Well, it really does look like checking for the presence of those ANDROID_*
> environment variables it the best way to recognize the Android platform.
> Anyone can do that without waiting for a ruling on whether Android is Linux
> or not (which would be necessary because the docs for sys.platform are
> quite clear about its value on Linux systems). Googling terms like "is
> Android Linux" suggests that there is considerable controversy about the
> issue, so I suggest you don't wait. :-)
I don't see sysconfig mentioned in the discussion (maybe for a
reason). It might provide build-time information e.g.,
built_for_android = 'android' in sysconfig.get_config_var('MULTIARCH')
assuming the complete value is something like 'arm-linux-android'. It
says that the python binary is built for android (the current platform
may or may not be Android).
--
Akira
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Exposing the Android platform existence to Python modules
Shiz writes: > The most obvious change would be to subprocess.Popen(). The reason a > generic approach there won't work is also the reason I expect more > changes might be needed: the Android file system doesn't abide by any > POSIX file system standards. Its shell isn't located at /bin/sh, but at > /system/bin/sh. The only directories it provides that are POSIX-standard > are /dev and /etc, to my knowledge. You could check to see if > /system/bin/sh exists and use that first, but that would break the > preferred shell on POSIX systems that happen to have /system for some > reason or another. In short: the preferred shell on POSIX systems is > /bin/sh, but on Android it's /system/bin/sh. Simple existence checking > might break the preferred shell on either. For more specific stdlib > examples I'd have to check the test suite again. FYI, /bin/sh is not POSIX, see http://bugs.python.org/issue16353#msg224514 -- Akira ___ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Exposing the Android platform existence to Python modules
But *are* we going to support Android officially? What's the point? Do you have a plan for getting Python apps to first-class status in the App Store (um, Google Play)? Regardless, I recommend that you add a new method to the platform module (careful people can test for the presence of the new method before calling it) and leave poor sys.platform alone. On Sat, Aug 2, 2014 at 10:18 PM, Shiz wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > Guido van Rossum wrote: > > Well, it really does look like checking for the presence of those > > ANDROID_* environment variables it the best way to recognize the > > Android platform. Anyone can do that without waiting for a ruling on > > whether Android is Linux or not (which would be necessary because the > > docs for sys.platform are quite clear about its value on Linux > > systems). Googling terms like "is Android Linux" suggests that there > > is considerable controversy about the issue, so I suggest you don't > > wait. :-) > > Right, which brings us back to the original point I was trying to make: > any chance we could move logic like that into a sys.getandroidversion() > or platform.android_version() so user code (and standard library code > alike) doesn't have to perform those relatively nasty checks themselves? > It seems like a fair thing to do if CPython would support Android as an > official target. > > Kind regards, > Shiz > -BEGIN PGP SIGNATURE- > Version: GnuPG/MacGPG2 v2.0.22 (Darwin) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQQcBAEBCgAGBQJT3cYHAAoJEICfd9ZVuxW+hSogAKg8FUz/SuH6d0a4QvDctpMO > pm58gBqVYvd1y/uIiLpQgpGb1dPrNziV1IYOBJaDcU1i/03JlgGdr3HOq29KvHdQ > xgaQQbsyl63Tzhs4oA2iow7eoRO5rkZ338hxpWrUQqRek73AYXJt2r5w9dRklUh/ > Z1R+80otVRAj69uJub8yAys08QqljKG80cnfQwUcFJVDWZRmr/z/WRGoC7QkRYVK > EfIa7EVlm/3mArmueF6vxgF5qHevXIHvVSf18JJ918gxldKLJ4ht1v8L/4h4QBrC > zfNqWyg8lXh6evMMH4lM755rycCTrtyzkoxmocLkUsEHrB65eOWWSBYdQgRMpuOH > SZs+9K+P1jPwsJlcHl8j4sXoG6NtL6BBim70nlEnvdWQ6qHMivBNcyA1gEwI7Upn > hG4t7AM4c3fdbkOg4V1F7EVrS9QqIxxWFIMAfYUGstZnfbBUDDGKIkE68ZbT+scq > RTLbh78WsVA/YB/NLnxKvCTCuJb2uwg7R/VC1bMlsTUqTSfmckHl/XSRrgk+ggve > A45sOKyoWzpfZEaAL9/e2TsPul5bRatVFX2JqEuzO42OTNZRr7GRxvRgF4tmnmG2 > baSfrEhm3rcIFxT2IqLy+28g7ffGKcbbq7oo7LPvrh+zIupamygCnvMs6aSPE3zi > Vi31EiFrZ8pn3YF+yfO7D9hjtqE41IIc86dKPUyKYfG+wO1oPXNwzBEZfoRSoJaY > 9EKd1fqOm9iYHHzr+mkEko/bl+SxNFHHJ/y/uEU6ZIhBjbylDJ9AKCAm5q9gotuT > 5i3PuyOOrTuYO0ei0su5Ya9UO5vD3+gUNKTHe9IdUL/e+5qYt5tjwtfPC9UTldSy > xLv8Ca0uC7mOHLPi8ASghoO2tbjy69TNYmzljqIGUufBOKshFnNWA7DDmQdYrdTN > t+EXsUAUmqm1RT29Zhrt1LCsoByyXh5jBapyIleU8TTrmotpX3dlI7rooZSegUiy > 8lD05oIjX+JRbfXXsNg384e6Stc6UktrhIK00w3ILVP9IqnqAO+dao/uE+5lLvxU > BcL9/PjmTY+1U8ZJCb9uZXNG8jWP2lsQEKaSFURkoUjTzfRpAoa6tVpCZOOvqZC2 > F52ZSwmUBtP7vydRJ7BZjOeRxDzMD8qd0ED3fciDRbnVdXHIG+8MFL5MY1CDm9i7 > r7bngcsqSUURq/Zj4BYnM8lOX1PXC9+U4gVNEkiwf+9CjfeIyMd4QpuMyXPxeiUa > QDU8MX5VdA1oBvJ2nbXV8QwriIfODbyhD/00QhLHw5ifKjxB8ZZdF4jNT+Ay9jnR > nEWuIpat3ch2Sg/ECtBvcA8hHYE9TfFZGdrdZVvib7fHsS+AUFXuhjAnkEyOVB4= > =m+JD > -END PGP SIGNATURE- > -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Exposing the Android platform existence to Python modules
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Guido van Rossum wrote: > But *are* we going to support Android officially? What's the point? > Do you have a plan for getting Python apps to first-class status in > the App Store (um, Google Play)? > > Regardless, I recommend that you add a new method to the platform > module (careful people can test for the presence of the new method > before calling it) and leave poor sys.platform alone. Well, that is the idea, at least empowering people to write proper Android apps in Python. The first step of that would be making CPython run on Android, the second step would be adding libraries that allow Python users to interface with the Android API. As I said, even if the CPython maintainers are not willing to support Android in the end, I'd at least like my patchset to be done according to CPython development guidelines/principles as close as possible. Adding android_version() to the platform module it is, then. hasattr(platform, 'android_version') is probably an easy enough check for Python users. Kind regards, Shiz -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQQcBAEBCgAGBQJT3l2hAAoJEICfd9ZVuxW+01AgALmVjV30qJ7HEOJEslb7sET4 9wPd1n3BLp/cmGxxLynMmQ6PDv5pHwjJT/QqwpW6xbYCnJ/5M5/8jMOXjMgedJ0C +wSx4/Detv0Cp5fXIFy3G8fS6yIm30mRrVzAq6gJ0I+NqkzR8S/DeIsonz/vJmEI aWxVra4jd7zPmAV/mUr0nwJ1xyEHWJnW+CPsc1FRI+YKgMbJnegFo+7GrthkuJen jmbrAQbt6FG0tKBGgmfL6r6r+c+5KSQYH+VLESpcIJGZbNr7IVpGhRB247njVLug AsqXFvabGU0/RHmJnLa0a09AH2NZYkhMqv9Ncaamf2DijVMN9Wez4UFpPTUkxNlJ qfK0S6vafDW0FKNNe07xn1fQi3Lrax1pZlX7emGp9TplsctPTNVEfnQfcgJpXlrj rATtH3MVxD7nf8WjYwGXcFpECxNdy1+096neqp9jkWkXpQZhr1qtUiXe6Ez4DUxe 4H1ZWOmuu+HJHVMN3wDjr5VUMcdzjUMA2DgHIkstfNqkEb3U4//5UFro5/plmGkc qvcU5SQMPKCff+LB2dvgpmYNVZDuj8AHb1t805KesW+eEmcIEgQ4zn+pcBr/+B13 8yal38Ms8jl9flqVcLFlqpAQyIcLdjtdMsyG3DUvZ26ChRF2NSITMYL6hn12VbEK UiXK8uus2YE0SRfJ1mJthg8vk+DOqGxsaT4XdvfoFykQo2W1JYKlS69Fnxsnl8MN 6KPNOmscQAfLfGKBiIjDqlcNFnKcAUJE5paywrNQkb3Kq+5NZqK3swNieOvaSI9b e23cP0GmCJUW0vlRJzjhpSpAMR4hy6TF8wEJavAb4s7IgQi928mVEVEFhVLDIXNi kZFG2BXQZ9aAc1pwBxFaeuGHvIAiJ+lYB6E6bg2LIEtDBeBSf8JMk1+FtIOaLD6L W/J0c2PHpSX11mPlmQBmQwbhSJ9s3lQE4bYVh7MQf/dPWLYFCO+8fXlRykZK10cj advO51WyrYldecSiAufyPShP0ouU6Qw7wrDByBxD7BmsCqwmblx8yNJz8pwvD33q hYVl3LWtf1KJIpC44Kcob06z2bi/r91nbIQgFm01LiIrwuPoa9ydrwl3ET+qrjle +FYXR0NEk3RmjNoo+MaXXfxrz4lUcFv+olGf6A/dVvsd8XpxibTaxBcpppTl6o9M oLYFw1c2f5psmrVByXpiEWuvjnSvcSnjEV7qlGI2dSGks1aq/R6otNenwr/BgamO OkvA9DmBKvfJ5MdATjYtVLSBj5om1yqQnGm1snqkDDnWIQx60i5LXeNvJE6XyD1s MM0d4WVZqNwZsrOa5/Yd2rHi1L+14aFctk40IocVUFOUrMVX52oKGyKovylRqNk= =N1mB -END PGP SIGNATURE- ___ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Exposing the Android platform existence to Python modules
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512
Akira Li wrote:
> FYI, /bin/sh is not POSIX, see
> http://bugs.python.org/issue16353#msg224514
Ah right, my apologies. Android doesn't seem to have getconf(1) either,
but sh /is/ on $PATH. Anyway, even if it weren't, os.defpath could be
tweaked on Android.
> I don't see sysconfig mentioned in the discussion (maybe for a
> reason). It might provide build-time information e.g.,
>
> built_for_android = 'android' in
> sysconfig.get_config_var('MULTIARCH')
>
> assuming the complete value is something like 'arm-linux-android'.
> It says that the python binary is built for android (the current
> platform may or may not be Android).
MULTIARCH is empty in my sysconfig (http://txt.shiz.me/MjBmOTQ4). You
could possibly match HOST_GNU_TYPE against 'androideabi', even though it
still seems a bit fragile. Please ignore MACHDEP/PLATDIR, those are set
as a result of me fiddling with sys.platform.
Kind regards,
Shiz
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQQcBAEBCgAGBQJT3lyaAAoJEICfd9ZVuxW+8D4gAL8Bi7gvHQlaDOPDWjILeFEy
DN7t4RGuVBGv2MYhMJPgHQy27bUAQLXtEWNYFGl8X9mK3BdDlrDfmcVxnN4hJPJD
iqWHlECN/yY4+fkzLbq85OHKyWKo410SHssyCd2X4WeGJL6PVcnq50/bYhsDd8gf
31ICjfDCs8ZFFSIxdb0KzLE7dXOIBnsB4QLFqi6KUwiJYls6JyOhfwYt1UU5/7he
J0urNh/cJomHCrod26A/C9sBGB6LcjIv5xIYosQ0C7dpYfRyfF+JRuzHcA2Wm6NY
gt1jAeRHSb+YihbuTwtsH6gPopXWdSY1IWtBX+Q98Je95weO12dI1M1BRCRk7yW1
AyRyclnBjFAKkYAzuCEIQxFBpmKYkO4W23CBjUvK21AmpV86sK1A6OWRPPADAthw
jQpXsfv2WFIEpZsVFZ2YQ1hTcdCnUdAoCaJbFkH8hhFXRF3A9asO1N0ff0sEFNe2
kRSJD8wzgMjy98c3xAmwfXCRCbM7kIkM87R2Mw+cIWC1/xV3erlOmCtKkVbAUJSK
3r+w33meFmYGQGrh3TaCScBIN6aoYTIQKJOGwWKYp8fa313qW8BQjSw7WzOLCjNM
8zDFuBfQJvVCs/eiMcFTMHaHBaXj9rNNw7pyQBwMXUQUWntIP/Pio6sZJEjJ4tM7
SIHtqfGT+kHN8PIPj/1PM9VuXge4Z97d2TXplwAfmNc2D/mvnfu0bswBVFuRzNi7
9a4P8jIrw5ZqMF/tKE7ykk79Xz3hwCEm+W8rzzqiz5P8Wn39YTXd5dX/EXaoOzmh
vWAF7opI7vHeA0f8rfkgkvBBhy6g74ku1Ie2k9KzrcMlKUMYEH60QWzcj1POT6oz
ovfciahZtAN11j0+M3GIKWnuLXTieoPOaYa4EuPe+ZFqTg1pAAX0z2saKNAXR7Fo
hITS1WeN3kenXmkAzWTkX+2tb+TtbKOhd5MURWMbUIaTFjzYvgFAtpyTHZExWO6a
zpWYcWBGFn4c16rgK8VD/UYIqA7xIwmhtkz0UBXtIM2za8AidR8nZph0cgpH0EnC
IwzjAy5WT2WxUGBHcRwA+FhPQYxZPcai/QAAs2VPLm3srmGvYwmLibqS0FUL+tME
xl5p/2NkwDuP3Q8TBvIMXmxTk5X0w7c8/cSGMYcujkK6dsodhrdmw2IwNf/pQ8tW
FUuY0znvfKfklqN6BfeN7tLF9rDlaHlOE0iRM24Qx1mFvKA9RXrhXok1BBO0WYK4
jklFC4WdYhqEw47GsXDkO8UmgvV3knoSX77g4Xq043hnbd8brydkEgd8OfqjX/JQ
4gKyYyW7yZAxrChxBg2DDyMmjMU89yLLpiI55yAdN+lT3N7aCj6DJWADNz20TvQ=
=TMlH
-END PGP SIGNATURE-
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Exposing the Android platform existence to Python modules
On 03/08/2014 4:58 pm, Guido van Rossum wrote: But *are* we going to support Android officially? What's the point? Do you have a plan for getting Python apps to first-class status in the App Store (um, Google Play)? I do... http://pyqt.sourceforge.net/Docs/pyqtdeploy/introduction.html Phil ___ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Exposing the Android platform existence to Python modules
On Sun, Aug 3, 2014 at 10:16 AM, Phil Thompson wrote: > On 03/08/2014 4:58 pm, Guido van Rossum wrote: > >> But *are* we going to support Android officially? What's the point? Do you >> have a plan for getting Python apps to first-class status in the App Store >> (um, Google Play)? >> > > I do... > > http://pyqt.sourceforge.net/Docs/pyqtdeploy/introduction.html > > Phil > Oooh, that's pretty cool! -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Exposing the Android platform existence to Python modules
On 4 Aug 2014 03:18, "Phil Thompson" wrote: > > On 03/08/2014 4:58 pm, Guido van Rossum wrote: >> >> But *are* we going to support Android officially? What's the point? Do you >> have a plan for getting Python apps to first-class status in the App Store >> (um, Google Play)? > > > I do... > > http://pyqt.sourceforge.net/Docs/pyqtdeploy/introduction.html Nice! I've only been skimming this thread, but +1 for Android mostly reading as Linux, but with an extra method in the platform module that gives more details. For those interested in mobile app development, Russell Keith-Magee also announced the release of "toga" [1] here at PyCon AU. That's a Python specific GUI library that maps directly to native widgets (rather than using theming as Kivy does). I mention it as one of the things Russell is specifically looking for is more participation from folks that know the Android side of things :) [1] http://pybee.org/toga/ Cheers, Nick. > > Phil > > ___ > Python-Dev mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com ___ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
