simple trick to make dealing with python 2/3 scripts easier
Damjan wrote:
>> The only problem with >> this approach is that /usr/bin/python is owned by the python package, so >> if you upgrade the python package it might create problems. Any one know >> of some way to work around this problem? > > Just put your script in /usr/local/bin But then some scripts use #!/usr/bin/python. Putting it in /usr/local/bin would only work if the script uses #!/usr/local/bin/python or #!/usr/bin/env python. |
simple trick to make dealing with python 2/3 scripts easier
Ben Booth wrote:
> Damjan wrote: > >>> The only problem with >>> this approach is that /usr/bin/python is owned by the python package, so >>> if you upgrade the python package it might create problems. Any one know >>> of some way to work around this problem? >> >> Just put your script in /usr/local/bin > > But then some scripts use #!/usr/bin/python. Putting it in /usr/local/bin > would only work if the script uses #!/usr/local/bin/python or > #!/usr/bin/env python. Maybe I'll submit a feature request to the python package maintainer to see if they think it's a good idea. |
simple trick to make dealing with python 2/3 scripts easier
Ben Booth wrote:
> > Maybe I'll submit a feature request to the python package maintainer to > see if they think it's a good idea. I submitted a feature request in case anyone's interested: https://bugs.archlinux.org/index.php?do=details&action=details.addvote&task_i d=31179 |
simple trick to make dealing with python 2/3 scripts easier
On Fri, Aug 17, 2012 at 11:09:06AM -0700, Ben Booth wrote:
> remove the /usr/bin/python symlink and replace with this shell script: > > #!/usr/bin/env bash > exec /usr/bin/"${PYTHON:-python3}" "$@" Bravo! I approve. This solution is 0.99 times as good as the option to just not have Python 3 |
simple trick to make dealing with python 2/3 scripts easier
Matthew Monaco <dgbaley27@0x01b.net> wrote:
> On 08/17/2012 04:14 PM, Ben Booth wrote: > > Don't know if you did this by accident -- and not a huge deal -- but you > shouldn't have included the vote action in the link. > Oops, my mistake. In any case, the request was rejected. :( |
simple trick to make dealing with python 2/3 scripts easier
In case anyone's still interested in this, I found a pacman.conf option
called NoExtract, which lets you tell pacman not to overwrite certain files and directories in the filesystem. So you could add the following line to /etc/pacman.conf: NoExtract = /usr/bin/python which would prevent pacman from overwriting the custom /usr/bin/python script. Here is the most recent version of the /usr/bin/python script: #!/usr/bin/env bash test "$PYTHON" != "python2" -a "$PYTHON" != "python3" && unset PYTHON exec /usr/bin/"${PYTHON:-python3}" "$@" This version does some input checking to make sure the only valid options for the PYTHON environment variable are "python2" or "python3". Ben |
simple trick to make dealing with python 2/3 scripts easier
Ben Booth wrote:
> In case anyone's still interested in this, I found a pacman.conf option > called NoExtract, which lets you tell pacman not to overwrite certain > files and directories in the filesystem. So you could add the following > line to /etc/pacman.conf: > > NoExtract = /usr/bin/python Actually it should be NoExtract = usr/bin/python without the root slash. sorry for the typo. Ben |
| All times are GMT. The time now is 07:41 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.