[master 6/6] Simplify supported methods in FS.py.

mulkieran installerbot-noreply at redhat.com
Wed Mar 11 22:08:15 UTC 2015


From: mulhern <amulhern at redhat.com>

Also, use super-call whenever possible. This doesn't change any behavior,
it is just a little tidier.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/biosboot.py |  3 ++-
 blivet/formats/fs.py       | 29 ++++++++---------------------
 blivet/formats/prepboot.py |  3 ++-
 3 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/blivet/formats/biosboot.py b/blivet/formats/biosboot.py
index 0c6c251..9fbcdd2 100644
--- a/blivet/formats/biosboot.py
+++ b/blivet/formats/biosboot.py
@@ -36,6 +36,7 @@ class BIOSBoot(DeviceFormat):
     _linuxNative = True                 # for clearpart
     _maxSize = Size("2 MiB")
     _minSize = Size("512 KiB")
+    _supported = True
 
     def __init__(self, **kwargs):
         """
@@ -56,7 +57,7 @@ def status(self):
 
     @property
     def supported(self):
-        return isinstance(platform.platform, platform.X86)
+        return super(BIOSBoot,self).supported and isinstance(platform.platform, platform.X86)
 
 register_device_format(BIOSBoot)
 
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index d9435c1..2782c66 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -1095,8 +1095,7 @@ class EFIFS(FATFS):
 
     @property
     def supported(self):
-        return (isinstance(platform.platform, platform.EFI) and
-                self.utilsAvailable)
+        return super(EFIFS, self).supported and isinstance(platform.platform, platform.EFI)
 
 register_device_format(EFIFS)
 
@@ -1176,11 +1175,7 @@ class GFS2(FS):
     @property
     def supported(self):
         """ Is this filesystem a supported type? """
-        supported = self._supported
-        if flags.gfs2:
-            supported = self.utilsAvailable
-
-        return supported
+        return self.utilsAvailable if flags.gfs2 else self._supported
 
 register_device_format(GFS2)
 
@@ -1205,11 +1200,7 @@ class JFS(FS):
     @property
     def supported(self):
         """ Is this filesystem a supported type? """
-        supported = self._supported
-        if flags.jfs:
-            supported = self.utilsAvailable
-
-        return supported
+        return self.utilsAvailable if flags.jfs else self._supported
 
 register_device_format(JFS)
 
@@ -1234,11 +1225,7 @@ class ReiserFS(FS):
     @property
     def supported(self):
         """ Is this filesystem a supported type? """
-        supported = self._supported
-        if flags.reiserfs:
-            supported = self.utilsAvailable
-
-        return supported
+        return self.utilsAvailable if flags.reiserfs else self._supported
 
 register_device_format(ReiserFS)
 
@@ -1300,11 +1287,11 @@ class AppleBootstrapFS(HFS):
     _name = N_("Apple Bootstrap")
     _minSize = Size("768 KiB")
     _maxSize = Size("1 MiB")
+    _supported = True
 
     @property
     def supported(self):
-        return (isinstance(platform.platform, platform.NewWorldPPC)
-                and self.utilsAvailable)
+        return super(AppleBootstrapFS, self).supported and isinstance(platform.platform, platform.NewWorldPPC)
 
 register_device_format(AppleBootstrapFS)
 
@@ -1333,11 +1320,11 @@ class MacEFIFS(HFSPlus):
     _labelfs = fslabeling.HFSPlusLabeling()
     _udevTypes = []
     _minSize = Size("50 MiB")
+    _supported = True
 
     @property
     def supported(self):
-        return (isinstance(platform.platform, platform.MacEFI) and
-                self.utilsAvailable)
+        return super(MacEFIFS, self).supported and isinstance(platform.platform, platform.MacEFI)
 
     def __init__(self, **kwargs):
         if "label" not in kwargs:
diff --git a/blivet/formats/prepboot.py b/blivet/formats/prepboot.py
index e44967a..6655510 100644
--- a/blivet/formats/prepboot.py
+++ b/blivet/formats/prepboot.py
@@ -39,6 +39,7 @@ class PPCPRePBoot(DeviceFormat):
     _linuxNative = True                 # for clearpart
     _maxSize = Size("10 MiB")
     _minSize = Size("4 MiB")
+    _supported = True
 
     def __init__(self, **kwargs):
         """
@@ -99,7 +100,7 @@ def status(self):
 
     @property
     def supported(self):
-        return isinstance(platform.platform, platform.IPSeriesPPC)
+        return super(PPCPRePBoot, self).supported and isinstance(platform.platform, platform.IPSeriesPPC)
 
 register_device_format(PPCPRePBoot)
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/c514bda2df891ad0bffb8ff39142e9dbfd47d159


More information about the anaconda-patches mailing list