zengxyz / rpms / anaconda

Forked from rpms/anaconda 4 months ago
Clone
fbcaed
From 4813b74c235bdfd911cd64c73c9eec1f795ebee5 Mon Sep 17 00:00:00 2001
fbcaed
From: Chris Lumens <clumens@redhat.com>
fbcaed
Date: Mon, 8 Sep 2014 15:07:50 -0400
fbcaed
Subject: [PATCH 29/30] A couple updates to installclasses.
fbcaed
fbcaed
Related: rhbz#1155452
fbcaed
fbcaed
Port of commit e8952489ce4c130612d6d06f3bc20155eb5fc102 from master.
fbcaed
fbcaed
* hidden and showHidden should be booleans, not ints in disguise.
fbcaed
* Get rid of default and id.  These are unused.
fbcaed
* Stop marking names for translation and remove mnemonics.  These haven't been
fbcaed
  used since the days of workstation/server/custom selection in the UI.  Does
fbcaed
  anyone else even still remember this?
fbcaed
---
fbcaed
 po/POTFILES.in                      |  4 ----
fbcaed
 pyanaconda/installclass.py          | 15 ++++++---------
fbcaed
 pyanaconda/installclasses/fedora.py |  8 ++------
fbcaed
 pyanaconda/installclasses/rhel.py   |  6 ++----
fbcaed
 4 files changed, 10 insertions(+), 23 deletions(-)
fbcaed
fbcaed
diff --git a/po/POTFILES.in b/po/POTFILES.in
fbcaed
index 8df1636..086e799 100644
fbcaed
--- a/po/POTFILES.in
fbcaed
+++ b/po/POTFILES.in
fbcaed
@@ -16,10 +16,6 @@ pyanaconda/product.py
fbcaed
 pyanaconda/rescue.py
fbcaed
 pyanaconda/vnc.py
fbcaed
 
fbcaed
-# Install class definitions
fbcaed
-pyanaconda/installclasses/fedora.py
fbcaed
-pyanaconda/installclasses/rhel.py
fbcaed
-
fbcaed
 # Packaging module source files
fbcaed
 pyanaconda/packaging/__init__.py
fbcaed
 pyanaconda/packaging/livepayload.py
fbcaed
diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
fbcaed
index 83af984..5415bc6 100644
fbcaed
--- a/pyanaconda/installclass.py
fbcaed
+++ b/pyanaconda/installclass.py
fbcaed
@@ -43,7 +43,7 @@ from pyanaconda.kickstart import getAvailableDiskSpace
fbcaed
 
fbcaed
 class BaseInstallClass(object):
fbcaed
     # default to not being hidden
fbcaed
-    hidden = 0
fbcaed
+    hidden = False
fbcaed
     name = "base"
fbcaed
     bootloaderTimeoutDefault = None
fbcaed
     bootloaderExtraArgs = []
fbcaed
@@ -64,9 +64,6 @@ class BaseInstallClass(object):
fbcaed
     # Blivet uses by default.
fbcaed
     defaultFS = None
fbcaed
 
fbcaed
-    # don't select this class by default
fbcaed
-    default = 0
fbcaed
-
fbcaed
     @property
fbcaed
     def l10n_domain(self):
fbcaed
         if self._l10n_domain is None:
fbcaed
@@ -124,8 +121,8 @@ class BaseInstallClass(object):
fbcaed
 allClasses = []
fbcaed
 allClasses_hidden = []
fbcaed
 
fbcaed
-# returns ( className, classObject, classLogo ) tuples
fbcaed
-def availableClasses(showHidden=0):
fbcaed
+# returns ( className, classObject ) tuples
fbcaed
+def availableClasses(showHidden=False):
fbcaed
     global allClasses
fbcaed
     global allClasses_hidden
fbcaed
 
fbcaed
@@ -195,7 +192,7 @@ def availableClasses(showHidden=0):
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
+                    if not obj.hidden or showHidden:
fbcaed
                         list.append(((obj.name, obj), sortOrder))
fbcaed
 
fbcaed
         except ImportError as e:
fbcaed
@@ -217,8 +214,8 @@ def availableClasses(showHidden=0):
fbcaed
 
fbcaed
 def getBaseInstallClass():
fbcaed
     # figure out what installclass we should base on.
fbcaed
-    allavail = availableClasses(showHidden = 1)
fbcaed
-    avail = availableClasses(showHidden = 0)
fbcaed
+    allavail = availableClasses(showHidden=True)
fbcaed
+    avail = availableClasses(showHidden=False)
fbcaed
 
fbcaed
     if len(avail) == 1:
fbcaed
         (cname, cobject) = avail[0]
fbcaed
diff --git a/pyanaconda/installclasses/fedora.py b/pyanaconda/installclasses/fedora.py
fbcaed
index 058fdba..ee2773f 100644
fbcaed
--- a/pyanaconda/installclasses/fedora.py
fbcaed
+++ b/pyanaconda/installclasses/fedora.py
fbcaed
@@ -22,17 +22,13 @@ from pyanaconda.product import productName
fbcaed
 from pyanaconda import network
fbcaed
 from pyanaconda import iutil
fbcaed
 from pyanaconda import nm
fbcaed
-from pyanaconda.i18n import _, N_
fbcaed
-
fbcaed
 import os, types
fbcaed
 
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
+    name = "Fedora"
fbcaed
     sortPriority = 10000
fbcaed
     if productName.startswith("Red Hat "):
fbcaed
-        hidden = 1
fbcaed
+        hidden = True
fbcaed
 
fbcaed
     _l10n_domain = "anaconda"
fbcaed
 
fbcaed
diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py
fbcaed
index a0dae4c..b7691cf 100644
fbcaed
--- a/pyanaconda/installclasses/rhel.py
fbcaed
+++ b/pyanaconda/installclasses/rhel.py
fbcaed
@@ -26,12 +26,10 @@ from pyanaconda import iutil
fbcaed
 import types
fbcaed
 
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
+    name = "Red Hat Enterprise Linux"
fbcaed
     sortPriority = 20000
fbcaed
     if not productName.startswith(("Red Hat ", "RHEL Atomic")):
fbcaed
-        hidden = 1
fbcaed
+        hidden = True
fbcaed
     defaultFS = "xfs"
fbcaed
 
fbcaed
     bootloaderTimeoutDefault = 5
fbcaed
-- 
fbcaed
1.9.3
fbcaed