Re: [arch-general] a plea for python 2
you all think the proper fix is for me to put in the docs something like "on Arch systems you need to do [x] before building", whether [x] is "get the PKGBUILD with the patch from AUR" or even "run the sed-python-with-python2.sh included in the distribution".
I personally don't think it is a proper fix - I think it is not a fix at all. My opinion is that Python3 is sufficiently different from Python2 to be considered a new language, not just a new version of old (thus it would be appropriate to use new name, 'python3', for it, leaving 'python' forever referring to python2). (That is, desire to be on the bleeding edge does not warrant breaking existing software) If I were you, I would probably stop putting shebangs into my Python scripts (so that they would be not executables), and write a shell wrapper script for every python script that figures out during runtime how python2 executable is called, and call python2 script using this python executables (or write single script with symbolic links to it with different names and use $0 shell variable to find which python script to call).
Or use #!/usr/bin/env python2. This should fix problems like python2 being in a different path among distribution. On 15 December 2011 17:51, Alex Bolgarov <alex@bolgarov.org> wrote:>> you all think the proper fix is for>> me to put in the docs something like "on Arch systems you need to do>> [x] before building", whether [x] is "get the PKGBUILD with the patch>> from AUR" or even "run the sed-python-with-python2.sh included in the>> distribution".>> I personally don't think it is a proper fix - I think it is not a fix> at all. My opinion is that Python3 is sufficiently different from> Python2 to be considered a new language, not just a new version of old> (thus it would be appropriate to use new name, 'python3', for it,> leaving 'python' forever referring to python2). (That is, desire to be> on the bleeding edge does not warrant breaking existing software)>> If I were you, I would probably stop putting shebangs into my Python> scripts (so that they would be not executables), and write a shell> wrapper script for every python script that figures out during runtime> how python2 executable is called, and call python2 script using this> python executables (or write single script with symbolic links to it> with different names and use $0 shell variable to find which python> script to call).
Sorry I meant 'in a different path among distributions'. Forgot to double-check. On 15 December 2011 17:56, Thanasis Georgiou <sakisds.s@gmail.com> wrote:
Or use #!/usr/bin/env python2. This should fix problems like python2 being in a different path among distribution.
+1 to archlinux initiative. Someone has to be the first and as always arch is there. Actually python, read python3, as default is one of the reasons I use arch. Hector On 15 December 2011 17:58, Thanasis Georgiou <sakisds.s@gmail.com> wrote:
Sorry I meant 'in a different path among distributions'. Forgot to double-check.
On 15 December 2011 17:56, Thanasis Georgiou <sakisds.s@gmail.com> wrote:
Or use #!/usr/bin/env python2. This should fix problems like python2 being in a different path among distribution.
-- Hector Martínez-Seara Monné mail: hseara@gmail.com Tel: +34656271145 Tel: +358442709253
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 15/12/11 14:20, Hector Martinez-Seara wrote:
+1 to archlinux initiative. Someone has to be the first and as always arch is there. Actually python, read python3, as default is one of the reasons I use arch. Hector
On 15 December 2011 17:58, Thanasis Georgiou <sakisds.s@gmail.com> wrote:
Sorry I meant 'in a different path among distributions'. Forgot to double-check.
On 15 December 2011 17:56, Thanasis Georgiou <sakisds.s@gmail.com> wrote:
Or use #!/usr/bin/env python2. This should fix problems like python2 being in a different path among distribution.
Guys (Thanasis and Hector), I beg you, stop the top-posting, it's hard to understand the whole thread when you do that .... thing. Thanks. - -- Angel Velásquez angvp @ irc.freenode.net Arch Linux Developer / Trusted User Linux Counter: #359909 http://www.angvp.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJO6jAdAAoJEEKh2xXsEzutl2QH/07ZA1xvOBjetzwxGhC/HVs+ i+sLdrEfcIg7VYP7kwRues8cG0RGa1BHMdIvcLD1FSWGPi7MXxwzwxbLf0LbnHdq n8xJBbn+zm9+pLK718jeKV3+EKRjnnMsbdK5O6aHSa0wnueFDKk2BhKtDxexCGk3 2bohOt+EKsaEg9/JBQNYvLPB2PiCnWe4mpmXwq1CGTB1nH02QTRZVsolx9UXGT0R qYWqbXFdhUgParqCewvalXAshn+/ySVg0BpTXz7/rNZDy/WKJDu1ACPVrgPbaxVc aYozjQxYzw3ELJNGfh8tIe5qjlETVskDpkrF5CadA4lqhQ+35r2VLP0Tf1qVoq0= =art4 -----END PGP SIGNATURE-----
On Thu, Dec 15, 2011 at 9:51 AM, Alex Bolgarov <alex@bolgarov.org> wrote:
you all think the proper fix is for me to put in the docs something like "on Arch systems you need to do [x] before building", whether [x] is "get the PKGBUILD with the patch from AUR" or even "run the sed-python-with-python2.sh included in the distribution".
I personally don't think it is a proper fix - I think it is not a fix at all. My opinion is that Python3 is sufficiently different from Python2 to be considered a new language, not just a new version of old (thus it would be appropriate to use new name, 'python3', for it, leaving 'python' forever referring to python2). (That is, desire to be on the bleeding edge does not warrant breaking existing software)
http://mail.python.org/pipermail/python-dev/2011-March/108562.html ... the thread starts here: http://mail.python.org/pipermail/python-dev/2011-March/108491.html ... if it hasn't been linked already. that discussion led to the aforementioned PEP, and was generally well-received (hence creation of the PEP).
If I were you, I would probably stop putting shebangs into my Python scripts (so that they would be not executables), and write a shell wrapper script for every python script that figures out during runtime how python2 executable is called, and call python2 script using this python executables (or write single script with symbolic links to it with different names and use $0 shell variable to find which python script to call).
you can factor out pieces into separate files and selectively import based on various criteria, like any other module. create an small bootstrap file that is python2/3 compatible and either run/import according to the binary you're running under, or re-exec under a different one (slightly rude form a user's perspective, but possible). a little funky, but you can test syntax using eval: http://stackoverflow.com/questions/446052/python-best-way-to-check-for-pytho... ... and catch SyntaxError. per: http://mail.python.org/pipermail/python-dev/2011-March/108495.html http://mail.python.org/pipermail/python-dev/2011-March/108499.html ... not sure if that's changed, but Arch isn't alone ... there was an incubation period of a couple years, until 3.2 release, for applications/libraries to catch up. python3 is here now, so let's give her a big welcome, and move on ;-) -- C Anthony
take a look at the kedpm PKGBUILD [1], the package have /usr/bin/python as shebang, but if you run: python2 setup.py the script will automatically fix the shebangs to /usr/bin/python2 before installing ** [1] https://aur.archlinux.org/packages/ke/kedpm/PKGBUILD On Fri, Dec 16, 2011 at 5:30 AM, C Anthony Risinger <anthony@xtfx.me> wrote:
On Thu, Dec 15, 2011 at 9:51 AM, Alex Bolgarov <alex@bolgarov.org> wrote:
you all think the proper fix is for me to put in the docs something like "on Arch systems you need to do [x] before building", whether [x] is "get the PKGBUILD with the patch from AUR" or even "run the sed-python-with-python2.sh included in the distribution".
I personally don't think it is a proper fix - I think it is not a fix at all. My opinion is that Python3 is sufficiently different from Python2 to be considered a new language, not just a new version of old (thus it would be appropriate to use new name, 'python3', for it, leaving 'python' forever referring to python2). (That is, desire to be on the bleeding edge does not warrant breaking existing software)
http://mail.python.org/pipermail/python-dev/2011-March/108562.html
... the thread starts here:
http://mail.python.org/pipermail/python-dev/2011-March/108491.html
... if it hasn't been linked already. that discussion led to the aforementioned PEP, and was generally well-received (hence creation of the PEP).
If I were you, I would probably stop putting shebangs into my Python scripts (so that they would be not executables), and write a shell wrapper script for every python script that figures out during runtime how python2 executable is called, and call python2 script using this python executables (or write single script with symbolic links to it with different names and use $0 shell variable to find which python script to call).
you can factor out pieces into separate files and selectively import based on various criteria, like any other module. create an small bootstrap file that is python2/3 compatible and either run/import according to the binary you're running under, or re-exec under a different one (slightly rude form a user's perspective, but possible).
a little funky, but you can test syntax using eval:
http://stackoverflow.com/questions/446052/python-best-way-to-check-for-pytho...
... and catch SyntaxError.
per:
http://mail.python.org/pipermail/python-dev/2011-March/108495.html http://mail.python.org/pipermail/python-dev/2011-March/108499.html
... not sure if that's changed, but Arch isn't alone ... there was an incubation period of a couple years, until 3.2 release, for applications/libraries to catch up. python3 is here now, so let's give her a big welcome, and move on ;-)
--
C Anthony
participants (6)
-
Alex Bolgarov
-
Angel Velásquez
-
C Anthony Risinger
-
Hector Martinez-Seara
-
Juan Diego Tascón
-
Thanasis Georgiou