Commit Graph

6 Commits (8707d4311112f589ff7dcaf7ed634dbcc3bd9fdb)

Author SHA1 Message Date
Jose M. Guisado 8707d43111 context: add add_partition method
This method wraps fdisk_add_partition. Allows modifying in-memory
partition table of a given context.

Remember that changes need to be written to disk using the
relevant fdisk_write_disklabel function wrapper.
2022-12-15 12:27:35 +01:00
Jose M. Guisado 46ad17eaa7 partition: add partno setter
Allows changing in-memory partno field of a Partition instance:

  >>> import fdisk
  >>> pa = fdisk.Partition()
  >>> pa.partno = 3
  >>> pa
  <libfdisk.Partition object at 0x7f4603a38f30, partno=3>

If partno is unset repr shows 'None':

  >>> import fdisk
  >>> pa = fdisk.Partition()
  >>> pa
  <libfdisk.Partition object at 0x7f86c4338f30, partno=None>
2022-12-15 12:27:22 +01:00
Jose M. Guisado bd2703c54e partition: return None if partno is unset
Undefined values in libfdisk should map to None type in Python.

Py_BuildValue("%d", -1); is also incorrectly formatted and raises an
error when executed.
2022-12-15 12:16:52 +01:00
Jose M. Guisado Gomez ba67cc7a7b Use c99 struct initialization
Declutters PyTypeObject struct initialization when declaring new types.
2022-04-28 15:47:55 +02:00
Jose M. Guisado Gomez ef613790e9 Add COPYING and license headers
LGPL2.1 or later.
2022-04-07 17:03:34 +02:00
Jose M. Guisado Gomez ca92f15e2a Initial commit
Add sources, setup.py and .gitignore

Build/Install:

	python setup.py build
	python setup.py install
2022-04-06 12:56:11 +02:00