Class Peez2
Encapsulates a sequence of operations with Peez2 partition
assistant. The partition scheme is expressed in MB (2^20 bytes).
Data structures about three different drives follow. The first one is
a hard drive:
{'device': '/dev/hda',
'info': {'status': ['STATUS #FRE|FRC|CLN|JLOG|LIN|WIN|FUL|UNP|UNK',
'VALUE # 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0'],
'oks': [['FREESPACE\n']],
'prim': '3 + 0 (3)',
'win': 0,
'free': 1,
'ext': 0,
'metacoms': ['4\n',
'5',
'6',
'7'],
'linux': 1,
'details': [{'fs': 'ext3',
'no': '1',
'bytes': 2146765824,
'sec': '63sec - 4192964sec',
'type': '0x0:Particion Primaria ',
'class': 'Type Generic Linux\n'},
{'fs': 'NOSF',
'no': '2',
'bytes': 2146798080,
'sec': '4192965sec - 8385929sec',
'type': '0x0:Particion Primaria ',
'class': 'PAV#3'}]},
'label': 'ST340014A',
'size': 40020664320L,
'no': 0}
This one is a CD-ROM drive:
{'device': '/dev/hdc',
'info': {'warn': ['Disco vacio sin tabla e particiones o disco no reconocido',
'UNKNOW LAYOUT'],
'status': ['STATUS #FRE|FRC|CLN|JLOG|LIN|WIN|FUL|UNP|UNK',
'VALUE # 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0'],
'opts': [['1',
'CR',
'Nueva partición. Ocupar todo el espacio \n'],
['2',
'CR',
'Nueva partición. Dejar espacio libre \n']]},
'label': 'HL-DT-STDVD-ROM GDR8163B',
'size': 575959040,
'no': 1}
This is only an example for testing purposes:
{'device': '/dev/strange',
'info': {},
'size': 1200000000,
'no': -1,
'label': 'FOR DEBUGGING PURPOSES ONLY'}
Method Summary |
|
__init__ (self,
binary,
common_arguments,
debug,
partition_scheme)
Detect locale and scan for drives. |
|
__call_peez2 (self,
args,
input)
Execute peez2 with arguments provided, if any. |
|
__get_info (self,
drive,
size,
more_args,
input)
Retrieve information about a drive . |
|
__scan_drives (self)
Retrieve the list of drives in the computer. |
|
auto_partition (self,
drive,
steps,
do_it)
Make 3 partitions automatically on the specified
device . |
|
get_drives (self)
Retrieve a list of drives. |
|
only_manually (self)
Decide if manual partitioning should be the only way available. |
__init__(self,
binary='peez2',
common_arguments='2> /dev/null',
debug=True,
partition_scheme={'home': 512, 'root': 2355, 'swap': 205})
(Constructor)
Detect locale and scan for drives.
-
|
__call_peez2(self,
args='',
input='')
Execute peez2 with arguments provided, if any. It is also
possible to specify an input.
-
|
__get_info(self,
drive,
size=None,
more_args='',
input=None)
Retrieve information about a drive . If a
size (in MB) is given, then options to get this space are
parsed as well. It is also possible to specify some additional
arguments (like -j or -x ). input
may be a string that will be piped into Peez2.
-
|
__scan_drives(self)
Retrieve the list of drives in the computer. Devices not
beginning with /dev/hd or /dev/sd are
ignored.
-
|
auto_partition(self,
drive,
steps=None,
do_it=True)
Make 3 partitions automatically on the specified
device . When progress_bar is not
None , it is updated dinamically as the partitioning
process goes on.
-
|
get_drives(self)
Retrieve a list of drives. Each unit is identified by its device
name (i.e. /dev/hda ) and has an associated human-readable
label (i.e. 75 GB, maestro en el bus primario (/dev/hda),
"ST380011A").
-
|
only_manually(self)
Decide if manual partitioning should be the only way available.
-
|