summaryrefslogtreecommitdiffstats
path: root/partedUtils.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-01-27 14:03:47 -0500
committerDavid Cantrell <dcantrell@redhat.com>2009-02-12 11:29:36 -1000
commite4ceb72d7a801eeaeefbadd0fa672199e10fe0b4 (patch)
tree9632f4b29d9caece6bc982eac4dad0d5f47a6cff /partedUtils.py
parentcd5877227d34078be7f51dc80c95d85119a0c6b1 (diff)
downloadanaconda-e4ceb72d7a801eeaeefbadd0fa672199e10fe0b4.tar.gz
anaconda-e4ceb72d7a801eeaeefbadd0fa672199e10fe0b4.tar.xz
anaconda-e4ceb72d7a801eeaeefbadd0fa672199e10fe0b4.zip
Don't use the native_type flag anymore.
In the old pyparted, this flag was marked with all sorts of warnings about how it would go away once certain constants were supported. We now support all the constants libparted exposes, so we don't need to keep ancient hacks around anymore.
Diffstat (limited to 'partedUtils.py')
-rw-r--r--partedUtils.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/partedUtils.py b/partedUtils.py
index f17197ac2..b7c6b14f9 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -57,7 +57,7 @@ def get_partition_file_system_type(part):
Return:
Filesystem object (as defined in fsset.py)
"""
- if part.fileSystem is None and part.native_type == 0x41:
+ if part.fileSystem is None and part.getFlag(parted.PARTITION_PREP):
ptype = fsset.fileSystemTypeGet("PPC PReP Boot")
elif part.fileSystem == None:
return None
@@ -103,12 +103,9 @@ def get_partition_drive(partition):
"""Return the device name for disk that PedPartition partition is on."""
return partition.geometry.device.path[5:]
-def map_foreign_to_fsname(type):
+def map_foreign_to_fsname(part):
"""Return the partition type associated with the numeric type."""
- if type in allPartitionTypesDict.keys():
- return allPartitionTypesDict[type]
- else:
- return _("Foreign")
+ return part._fileSystem._type.name
def filter_partitions(disk, func):
rc = []
@@ -297,15 +294,14 @@ def validateFsType(part):
part.system = fstype
return
-def isLinuxNativeByNumtype(numtype):
+def isLinuxNative(part):
"""Check if the type is a 'Linux native' filesystem."""
- linuxtypes = [0x82, 0x83, 0x8e, 0xfd]
-
- for t in linuxtypes:
- if int(numtype) == t:
- return 1
-
- return 0
+ fstype = part._fileSystem._type
+ if part.getFlag(parted.PARTITION_RAID) or parted.getFlag(parted.PARTITION_LVM) or \
+ part.getFlag(parted.PARTITION_SWAP) or fstype.name in ["ext2", "ext3", "jfs", "reiserfs", "xfs"]:
+ return True
+ else:
+ return False
def getReleaseString(mountpoint):
if os.access(mountpoint + "/etc/redhat-release", os.R_OK):
@@ -400,7 +396,7 @@ class DiskSet:
def onlyPrimaryParts(self):
for disk in self.disks.values():
- if disk.type.check_feature(parted.DISK_TYPE_EXTENDED):
+ if disk.supportsFeature(parted.DISK_TYPE_EXTENDED):
return 0
return 1
@@ -1011,7 +1007,7 @@ class DiskSet:
if not self.disks.has_key(drive):
try:
dev = parted.getDevice("/dev/%s" % (drive,))
- disk = parted.Disk.(device=dev)
+ disk = parted.Disk(device=dev)
self._addDisk(drive, disk)
except:
self._removeDisk(drive)