def getPartedVersion():
   import parted
   try:
      return float(parted.version()['libparted'])
   except SystemError:
      from _ped import libparted_version
      return float(libparted_version())
   except:
      return 1
Example #2
0
def single_partition_device(device, vars, log):
    """
    initialize a disk by removing the old partition tables,
    and creating a new single partition that fills the disk.

    return 1 if sucessful, 0 otherwise
    """

    # two forms, depending on which version of pyparted we have
    # v1 does not have a 'version' method
    # v2 and above does, but to make it worse,
    # parted-3.4 on f14 has parted.version broken and raises SystemError
    try:
        parted.version()
        return single_partition_device_2_x(device, vars, log)
    except AttributeError:
        # old parted does not have version at all
        return single_partition_device_1_x(device, vars, log)
    except SystemError:
        # let's assume this is >=2
        return single_partition_device_2_x(device, vars, log)
    except:
        raise
def single_partition_device(device, vars, log):
    """
    initialize a disk by removing the old partition tables,
    and creating a new single partition that fills the disk.

    return 1 if sucessful, 0 otherwise
    """

    # two forms, depending on which version of pyparted we have
    # v1 does not have a 'version' method
    # v2 and above does, but to make it worse,
    # parted-3.4 on f14 has parted.version broken and raises SystemError
    try:
        parted.version()
        return single_partition_device_2_x(device, vars, log)
    except AttributeError:
        # old parted does not have version at all
        return single_partition_device_1_x(device, vars, log)
    except SystemError:
        # let's assume this is >=2
        return single_partition_device_2_x(device, vars, log)
    except:
        raise
 def runTest(self):
     ver = parted.version()
     self.assertEquals(ver['libparted'], _ped.libparted_version())
     self.assertEquals(ver['pyparted'], _ped.pyparted_version())
Example #5
0
 def runTest(self):
     ver = parted.version()
     self.assertEqual(ver['libparted'], _ped.libparted_version())
     self.assertEqual(ver['pyparted'], _ped.pyparted_version())
Example #6
0
def displayVersion(cmd):
    ver = parted.version()

    sys.stdout.write("%s:\n" % (cmd,))
    sys.stdout.write("pyparted version: %s.%s.%s\n" % (ver["pyparted"][0], ver["pyparted"][1], ver["pyparted"][2]))
    sys.stdout.write("libparted version: %s\n" % ver["libparted"])