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