[Svnmerge] Problems with latest stable svnmerge.py on RHEL4
Ted Stern
dodecatheon at gmail.com
Fri May 8 14:45:50 PDT 2009
On 08 May 2009 14:14:35 -0700, Steinar Bang wrote:
>
> So I'm guessing I need a newer python than RHEL4's python 2.3.3.
>
I also run on RHEL4. I have found that svnmerge.py requires 2.3.4 or
above and works best with 2.5 and above. I'm leary of using python 3+
because some backward compatibility was lost.
I have a trick for helping python scripts find newer versions of
python in non-traditional places.
At the top of my python script, I put
#!/usr/bin/env python2.5
and then I create this script named python2.5. If you actually have
python 2.5 installed, there is a python2.5 link available already,
otherwise this script is found:
,----[ python2.5 ]
| #!/bin/sh
| # Shell wrapper to find python-2.5 in non-standard paths
| # Set up with paths in order of
| # CFD Aero, Data Center clusters, Data Center x1dev
| # CFD Aero backup, /usr/local/bin and default path
| #
| export dirlist
| dirlist="/ots/sw/ActivePython-2.5/bin
| /ots/sw/python-2.5/bin
| /ots_cluster/sw/python-2.5/bin"
| for dir in $dirlist ; do
| if [ -x $dir/python ] ; then
| PATH=$dir:$PATH; export PATH
| exec $dir/python ${1+"$@"}
| fi
| done
|
| errormsg () {
| printf "`basename $0`:\nCannot find python 2.5 or higher in\n\t$dirlist\nor \$PATH\n" >&2
| }
|
| # See if there's a python in the current path
| type python 1>/dev/null 2>&1 || { errormsg; exit 1; }
|
| # There is, so let's see if it is 2.5 or higher (but not 3):
| pyvers="`python -V 2>&1 |cut -f2 -d' '`"
| pyvers=${pyvers%.*}; pymajor=${pyvers%.*}; pyminor=${pyvers#*.}
| [ $pymajor -eq 2 -a $pyminor -gt 4 ] && exec python ${1+"$@"}
|
| errormsg
| printf "Found python version ${pymajor}.${pyminor}.x\n" >&2
| exit 2
`----
Modify the dirlist variable as necessary to support all the different
locations it might be called from (e.g. different linux distros,
hosts, networks, etc.).
By the way, the same kind of trick can be used for other interpreters
such as perl or tclsh.
Ted
--
Frango ut patefaciam -- I break so that I may reveal
More information about the Svnmerge
mailing list