summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2006-07-24 20:47:55 +0000
committerJeremy Katz <katzj@redhat.com>2006-07-24 20:47:55 +0000
commitc2e807d64b907102d8580a01a704613ff45c0742 (patch)
treeade8260786aacc38c1b01cab0e1a611b6b783aed /iutil.py
parent981992dbe7e043dd312e7a7e25345a704b7b7bd2 (diff)
downloadanaconda-c2e807d64b907102d8580a01a704613ff45c0742.tar.gz
anaconda-c2e807d64b907102d8580a01a704613ff45c0742.tar.xz
anaconda-c2e807d64b907102d8580a01a704613ff45c0742.zip
2006-07-24 Jeremy Katz <katzj@redhat.com>
* iutil.py (isMactel): Make this persist so we don't run dmidecode a bazillion times
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/iutil.py b/iutil.py
index 611eccda8..fc6f09b3a 100644
--- a/iutil.py
+++ b/iutil.py
@@ -345,17 +345,25 @@ def getPPCMacBook():
return 1
return 0
+mactel = None
# return True if this is one of the Intel-based Apple Macs
def isMactel():
+ global mactel
+ if mactel is not None:
+ return mactel
+
if rhpl.getArch() not in ("x86_64", "i386"):
- return False
- if not os.path.exists("/usr/sbin/dmidecode"):
- return False
- buf = execWithCapture("/usr/sbin/dmidecode",
- ["dmidecode", "-s", "system-manufacturer"])
- if buf.lower().find("apple") != -1:
- return True
- return False
+ mactel = False
+ elif not os.path.exists("/usr/sbin/dmidecode"):
+ mactel = False
+ else:
+ buf = execWithCapture("/usr/sbin/dmidecode",
+ ["dmidecode", "-s", "system-manufacturer"])
+ if buf.lower().find("apple") != -1:
+ mactel = True
+ else:
+ mactel = False
+ return mactel
def hasNX():
"""Convenience function to see if a machine supports the nx bit. We want