A couple of little issues... On Wed, 2010-02-10 at 15:12 -0500, Chris Lumens wrote: > --- > anaconda | 64 ++++++++++++++++++++----------------------------------------- > 1 files changed, 21 insertions(+), 43 deletions(-) > > diff --git a/anaconda b/anaconda > index e9b620a..6dc0a96 100755 > --- a/anaconda > +++ b/anaconda > @@ -112,50 +112,28 @@ def doShutdownX11Actions(): > except: > pass > > -# handle updates of just a single file in a python package > def setupPythonUpdates(): > - import glob > + from distutils.sysconfig import get_python_lib > + > + for pkg in filter(os.path.isdir, os.listdir("/tmp/updates")): This will almost always be an empty list since os.listdir returns basenames. > + # See if the package exists in /usr/lib{64,}/python/?.?/site-packages. > + # If it does, we can set it up as an update. If not, the pkg is > + # likely a completely new directory and should not be looked at. > + dest = "%s/%s" % (get_python_lib(), pkg) > + if not os.access(dest, os.R_OK): > + dest = "%s/%s" % (get_python_lib(1), pkg) > + if not os.access(dest, os.R_OK): > + continue > > - # get the python version. first of /usr/lib/python*, strip off the > - # first 15 chars > - pyvers = glob.glob("/usr/lib/python*") > - pyver = pyvers[0][15:] > - > - try: > - os.mkdir("/tmp/updates") > - except: > - pass > + contents = os.listdir(pkg) Similar problem here -- os.listdir("/tmp/updates/" + pkg) would work, although I expect your solution to the above will dictate how you solve this one. Otherwise, looks good. Dave > > - for pypkg in ("block", "yum", "rpmUtils", "urlgrabber", "pykickstart", "parted", "meh"): > - # get the libdir. *sigh* > - if os.access("/usr/lib64/python%s/site-packages/%s" %(pyver, pypkg), > - os.X_OK): > - libdir = "lib64" > - elif os.access("/usr/lib/python%s/site-packages/%s" %(pyver, pypkg), > - os.X_OK): > - libdir = "lib" > - else: > - # If the directory doesn't exist, there's nothing to link over. > - # This happens if we forgot to include one of the above packages > - # in the image, for instance. > - continue > + # Symlink over everything that's in the python libdir but not in > + # the updates directory. > + for f in filter(lambda fn: fn not in contents, os.listdir(dest)): > + if f.endswith(".pyc") or f.endswith(".pyo"): > + continue > > - if os.access("/tmp/updates/%s" %(pypkg,), os.X_OK): > - for f in os.listdir("/usr/%s/python%s/site-packages/%s" %(libdir, > - pyver, > - pypkg)): > - if os.access("/tmp/updates/%s/%s" %(pypkg, f), os.R_OK): > - continue > - elif (f.endswith(".pyc") and > - os.access("/tmp/updates/%s/%s" %(pypkg, f[:-1]),os.R_OK)): > - # dont copy .pyc files we are replacing with updates > - continue > - else: > - os.symlink("/usr/%s/python%s/site-packages/%s/%s" %(libdir, > - pyver, > - pypkg, > - f), > - "/tmp/updates/%s/%s" %(pypkg, f)) > + os.symlink("%s/%s" % (dest, f), "/tmp/updates/%s/%s" % (pkg, f)) > > if os.access("/tmp/updates/70-anaconda.rules", os.R_OK): > import shutil _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list