Re: [PATCH] Add all possible install class locations to the search path (#587696).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ack.

On Fri, 30 Apr 2010, Chris Lumens wrote:

RHEL6 install classes inherit from each other.  In order for anaconda to import
a subclass, it's going to have to have the location of the subclass in the path
too.

Also, fix the base RHEL install class's name so we don't get an import error.
---
installclass.py        |   21 +++++++++++----------
installclasses/rhel.py |    2 +-
2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/installclass.py b/installclass.py
index 6756405..deb7e53 100644
--- a/installclass.py
+++ b/installclass.py
@@ -245,20 +245,21 @@ def availableClasses(showHidden=0):
    else:
        if allClasses_hidden: return allClasses_hidden

-    if os.access("installclasses", os.R_OK):
-	path = "installclasses"
-    elif os.access("/tmp/updates/installclasses", os.R_OK):
-        path = "/tmp/updates/installclasses"
-    elif os.access("/tmp/product/installclasses", os.R_OK):
-        path = "/tmp/product/installclasses"
-    else:
-	path = "/usr/lib/anaconda/installclasses"
+    path = []
+
+    for dir in ["installclasses", "/tmp/updates/installclasses",
+                "/tmp/product/installclasses", "/usr/lib/anaconda/installclasses"]:
+        if os.access(dir, os.R_OK):
+            path.append(dir)

    # append the location of installclasses to the python path so we
    # can import them
-    sys.path.insert(0, path)
+    sys.path = path + sys.path
+
+    files = []
+    for p in reversed(path):
+        files += os.listdir(p)

-    files = os.listdir(path)
    done = {}
    list = []
    for file in files:
diff --git a/installclasses/rhel.py b/installclasses/rhel.py
index 7aaf356..46dfca8 100644
--- a/installclasses/rhel.py
+++ b/installclasses/rhel.py
@@ -27,7 +27,7 @@ import types
import installmethod
import yuminstall

-class RHELInstallClass(BaseInstallClass):
+class InstallClass(BaseInstallClass):
    # name has underscore used for mnemonics, strip if you dont need it
    id = "rhel"
    name = N_("Red Hat Enterprise Linux")


- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkvbOasACgkQ5hsjjIy1VklX5QCfVd0H/RLRqQ8hyUQMU6aXV3v4
0+8An2ei9O+isdOJ1W1RRBn6zPXPsKQy
=YDeU
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux