Has Red Hat helped or hurt?

Harry George hgg9140 at seanet.com
Wed May 8 20:00:22 EDT 2002


Tim Roberts <timr at probo.com> writes:

> Red Hat 7.x uses Python 1.52 for many of its configuration and
> administration activities.  Ordinarily, I'd say this was a Good Thing for
> the betterment and furtherance of Python.
> 
> However, it makes it deucedly difficult to upgrade away from 1.52.  If one
> upgrades /usr/bin/python to be 2.x, all of Red Hat's custom configuration
> scripts are no longer found in site-packages.
> 
> How have other people handled this?  Do you just copy all of
> 1.52/site-packages to 2.x/site-packages?  Do you install Python 2.x into a
> separate directory and grumble every time you have to change the #! line in
> your scripts?  I tried updating all of the #! lines in the Red Hat scripts,
> but this, of course, blows as soon as you do an rpm upgrade of a
> Python-based package.
> --
> - Tim Roberts, timr at probo.com
>   Providenza & Boekelheide, Inc.

I think this has been discussed previously.  Here is my approach:

1. Do absolutely nothing to the py1.5.2 installation or the RH
   scripts.  Leave it exactly as is.

2. In your .bashrc (or equiv), put in:
       unset PYTHONHOME PYTHONPATH
   This keeps the RH defaults from pushing you into using 1.5.2
   libraries.

3. Install py2.1, py2.2, etc in /usr/local.  Call all your own scripts
   with these binaries (either on the #! line or on the commandline).
   The binary will look for PYTHONHOME and PYTHONPATH, not find them,
   and will go with its defaults.  This way you can have several
   versions installed and operational at the same time.

4. If you need to force some paths, make a script, e.g. "py22" which
   does:

       #!/bin/sh
       export PYTHONHOME=my_special_place
       /usr/local/bin/python2.2 "$@"

   Call this as "py22"


-- 
Harry George
hgg9140 at seanet.com



More information about the Python-list mailing list