コード例 #1
0
ファイル: test__ped_ped.py プロジェクト: g2p/pyparted
    def runTest(self):
        for f in [_ped.PARTITION_BOOT, _ped.PARTITION_ROOT, _ped.PARTITION_SWAP,
                  _ped.PARTITION_HIDDEN, _ped.PARTITION_RAID, _ped.PARTITION_LVM,
                  _ped.PARTITION_LBA, _ped.PARTITION_HPSERVICE,
                  _ped.PARTITION_PALO, _ped.PARTITION_PREP,
                  _ped.PARTITION_MSFT_RESERVED,
                  _ped.PARTITION_APPLE_TV_RECOVERY,
                  _ped.PARTITION_BIOS_GRUB, _ped.PARTITION_DIAG]:
            self.assertNotEqual(_ped.partition_flag_get_name(f), "", "Could not get name for flag %s" % f)

        self.assertRaises(ValueError, _ped.partition_flag_get_name, -1)
        self.assertRaises(ValueError, _ped.partition_flag_get_name, 1000)
コード例 #2
0
ファイル: test__ped_ped.py プロジェクト: carlroth/pyparted
    def runTest(self):
        for f in ['PARTITION_BOOT', 'PARTITION_ROOT', 'PARTITION_SWAP',
                  'PARTITION_HIDDEN', 'PARTITION_RAID', 'PARTITION_LVM',
                  'PARTITION_LBA', 'PARTITION_HPSERVICE',
                  'PARTITION_PALO', 'PARTITION_PREP',
                  'PARTITION_MSFT_RESERVED',
                  'PARTITION_APPLE_TV_RECOVERY',
                  'PARTITION_BIOS_GRUB', 'PARTITION_DIAG',
                  'PARTITION_MSFT_DATA', 'PARTITION_IRST',
                  'PARTITION_ESP', 'PARTITION_NONFS']:
            if not hasattr(_ped, f):
                continue
            attr = getattr(_ped, f)
            self.assertNotEqual(_ped.partition_flag_get_name(attr), "", "Could not get name for flag _ped.%s" % f)

        self.assertRaises(ValueError, _ped.partition_flag_get_name, -1)
        self.assertRaises(ValueError, _ped.partition_flag_get_name, 1000)
コード例 #3
0
    def runTest(self):
        for f in ['PARTITION_BOOT', 'PARTITION_ROOT', 'PARTITION_SWAP',
                  'PARTITION_HIDDEN', 'PARTITION_RAID', 'PARTITION_LVM',
                  'PARTITION_LBA', 'PARTITION_HPSERVICE',
                  'PARTITION_PALO', 'PARTITION_PREP',
                  'PARTITION_MSFT_RESERVED',
                  'PARTITION_APPLE_TV_RECOVERY',
                  'PARTITION_BIOS_GRUB', 'PARTITION_DIAG',
                  'PARTITION_MSFT_DATA', 'PARTITION_IRST',
                  'PARTITION_ESP']:
            if not hasattr(_ped, f):
                continue
            attr = getattr(_ped, f)
            self.assertNotEqual(_ped.partition_flag_get_name(attr), "", "Could not get name for flag _ped.%s" % f)

        self.assertRaises(ValueError, _ped.partition_flag_get_name, -1)
        self.assertRaises(ValueError, _ped.partition_flag_get_name, 1000)
コード例 #4
0
        return math.floor(maxLength *
                          math.pow(sectorSize, parted._exponent[lunit]))

    def getDeviceNodeName(self):
        """Return the device name for this Partition."""
        return self.path[5:]

    def getPedPartition(self):
        """Return the _ped.Partition object contained in this Partition.
           For internal module use only."""
        return self.__partition

    def resetNumber(self):
        """Reset the partition's number to default"""
        return self.__partition.reset_num()


# collect all partition flags and store them in a hash
partitionFlag = {}
__flag = _ped.partition_flag_next(0)
partitionFlag[__flag] = _ped.partition_flag_get_name(__flag)
__readFlags = True

while __readFlags:
    __flag = _ped.partition_flag_next(__flag)
    if not __flag:
        __readFlags = False
    else:
        partitionFlag[__flag] = _ped.partition_flag_get_name(__flag)
コード例 #5
0
ファイル: partition.py プロジェクト: david-caro/pyparted
            else:
                break

        return math.floor(maxLength * math.pow(sectorSize, parted._exponent[lunit]))

    def getDeviceNodeName(self):
        """Return the device name for this Partition."""
        return self.path[5:]

    def getPedPartition(self):
        """Return the _ped.Partition object contained in this Partition.
           For internal module use only."""
        return self.__partition

    def resetNumber(self):
        """Reset the partition's number to default"""
        return self.__partition.reset_num()

# collect all partition flags and store them in a hash
partitionFlag = {}
__flag = _ped.partition_flag_next(0)
partitionFlag[__flag] = _ped.partition_flag_get_name(__flag)
__readFlags = True

while __readFlags:
    __flag = _ped.partition_flag_next(__flag)
    if not __flag:
        __readFlags = False
    else:
        partitionFlag[__flag] = _ped.partition_flag_get_name(__flag)