|
|
fbcaed |
From b50aab52e9e45178c317cb6efc258244a1943161 Mon Sep 17 00:00:00 2001
|
|
|
fbcaed |
From: Chris Lumens <clumens@redhat.com>
|
|
|
fbcaed |
Date: Fri, 5 Sep 2014 14:19:45 -0400
|
|
|
fbcaed |
Subject: [PATCH 28/30] Let finding install classes be more flexible for Fedora
|
|
|
fbcaed |
(#1155452).
|
|
|
fbcaed |
|
|
|
fbcaed |
Related: rhbz#1155452
|
|
|
fbcaed |
|
|
|
fbcaed |
(1) Make it so a valid install class does not have to be named "InstallClass"
|
|
|
fbcaed |
which should make inheritance less cumbersome.
|
|
|
fbcaed |
|
|
|
fbcaed |
(2) Allow putting more than one install class into a single file.
|
|
|
fbcaed |
|
|
|
fbcaed |
(3) Rename the existing install classes to be <distro>BaseInstallClass. This
|
|
|
fbcaed |
makes it more clear for subclasses where they're coming from.
|
|
|
fbcaed |
|
|
|
fbcaed |
Port of commit 8c2550d20d7fd8964cd3ec5797ff34949fe0f8fd from master.
|
|
|
fbcaed |
---
|
|
|
fbcaed |
pyanaconda/installclass.py | 16 ++++++----------
|
|
|
fbcaed |
pyanaconda/installclasses/fedora.py | 2 +-
|
|
|
fbcaed |
pyanaconda/installclasses/rhel.py | 2 +-
|
|
|
fbcaed |
3 files changed, 8 insertions(+), 12 deletions(-)
|
|
|
fbcaed |
|
|
|
fbcaed |
diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
|
|
|
fbcaed |
index 76609de..83af984 100644
|
|
|
fbcaed |
--- a/pyanaconda/installclass.py
|
|
|
fbcaed |
+++ b/pyanaconda/installclass.py
|
|
|
fbcaed |
@@ -183,7 +183,6 @@ def availableClasses(showHidden=0):
|
|
|
fbcaed |
if done.has_key(mainName): continue
|
|
|
fbcaed |
done[mainName] = 1
|
|
|
fbcaed |
|
|
|
fbcaed |
-
|
|
|
fbcaed |
try:
|
|
|
fbcaed |
found = imputil.imp.find_module(mainName)
|
|
|
fbcaed |
except ImportError as e:
|
|
|
fbcaed |
@@ -192,16 +191,13 @@ def availableClasses(showHidden=0):
|
|
|
fbcaed |
|
|
|
fbcaed |
try:
|
|
|
fbcaed |
loaded = imputil.imp.load_module(mainName, found[0], found[1], found[2])
|
|
|
fbcaed |
+ for (_key, obj) in loaded.__dict__.items():
|
|
|
fbcaed |
+ # If it's got these two methods, it's an InstallClass.
|
|
|
fbcaed |
+ if hasattr(obj, "setDefaultPartitioning") and hasattr(obj, "setPackageSelection"):
|
|
|
fbcaed |
+ sortOrder = getattr(obj, "sortPriority", 0)
|
|
|
fbcaed |
+ if obj.hidden == 0 or showHidden == 1:
|
|
|
fbcaed |
+ list.append(((obj.name, obj), sortOrder))
|
|
|
fbcaed |
|
|
|
fbcaed |
- obj = loaded.InstallClass
|
|
|
fbcaed |
-
|
|
|
fbcaed |
- if obj.__dict__.has_key('sortPriority'):
|
|
|
fbcaed |
- sortOrder = obj.sortPriority
|
|
|
fbcaed |
- else:
|
|
|
fbcaed |
- sortOrder = 0
|
|
|
fbcaed |
-
|
|
|
fbcaed |
- if obj.hidden == 0 or showHidden == 1:
|
|
|
fbcaed |
- list.append(((obj.name, obj), sortOrder))
|
|
|
fbcaed |
except ImportError as e:
|
|
|
fbcaed |
log.warning ("module import of %s failed: %s" % (mainName, sys.exc_type))
|
|
|
fbcaed |
if flags.debug: raise
|
|
|
fbcaed |
diff --git a/pyanaconda/installclasses/fedora.py b/pyanaconda/installclasses/fedora.py
|
|
|
fbcaed |
index 3e0a5f2..058fdba 100644
|
|
|
fbcaed |
--- a/pyanaconda/installclasses/fedora.py
|
|
|
fbcaed |
+++ b/pyanaconda/installclasses/fedora.py
|
|
|
fbcaed |
@@ -26,7 +26,7 @@ from pyanaconda.i18n import _, N_
|
|
|
fbcaed |
|
|
|
fbcaed |
import os, types
|
|
|
fbcaed |
|
|
|
fbcaed |
-class InstallClass(BaseInstallClass):
|
|
|
fbcaed |
+class FedoraBaseInstallClass(BaseInstallClass):
|
|
|
fbcaed |
# name has underscore used for mnemonics, strip if you dont need it
|
|
|
fbcaed |
id = "fedora"
|
|
|
fbcaed |
name = N_("_Fedora")
|
|
|
fbcaed |
diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py
|
|
|
fbcaed |
index 8a694e3..a0dae4c 100644
|
|
|
fbcaed |
--- a/pyanaconda/installclasses/rhel.py
|
|
|
fbcaed |
+++ b/pyanaconda/installclasses/rhel.py
|
|
|
fbcaed |
@@ -25,7 +25,7 @@ from pyanaconda import nm
|
|
|
fbcaed |
from pyanaconda import iutil
|
|
|
fbcaed |
import types
|
|
|
fbcaed |
|
|
|
fbcaed |
-class InstallClass(BaseInstallClass):
|
|
|
fbcaed |
+class RHELBaseInstallClass(BaseInstallClass):
|
|
|
fbcaed |
# name has underscore used for mnemonics, strip if you dont need it
|
|
|
fbcaed |
id = "rhel"
|
|
|
fbcaed |
name = N_("Red Hat Enterprise Linux")
|
|
|
fbcaed |
--
|
|
|
fbcaed |
1.9.3
|
|
|
fbcaed |
|