Add the basics for a high level IsoFS class. I have no proof that it currently
works correctly.
This commit is contained in:
parent
7ba96957e4
commit
998333ae78
@ -2,6 +2,7 @@
|
||||
|
||||
import core
|
||||
import defines
|
||||
import os.path
|
||||
|
||||
def _wrap_volume_property(var_name, core_setter):
|
||||
def get(self):
|
||||
@ -22,9 +23,36 @@ class IsoFS(object):
|
||||
volume_id, publisher_id, data_preparer_id)
|
||||
self._volset = core.iso_volset_new(self._volume, volume_id)
|
||||
|
||||
def __del__(self):
|
||||
core.iso_volume_free(self._volume)
|
||||
core.iso_volset_free(self._volset)
|
||||
|
||||
volume_id = _wrap_volume_property(
|
||||
'_volume_id', core.iso_volume_set_volume_id)
|
||||
publisher_id = _wrap_volume_property(
|
||||
'_publisher_id', core.iso_volume_set_publisher_id)
|
||||
data_preparer_id = _wrap_volume_property(
|
||||
'_data_preparer_id', core.iso_volume_set_data_preparer_id)
|
||||
|
||||
def add(self, disc_path, path, exclude=None): #, make_parents=False):
|
||||
disc_path = os.path.normpath(disc_path)
|
||||
path = os.path.abspath(os.path.normpath(path))
|
||||
exclude = exclude or []
|
||||
|
||||
# Does the disc parent exist?
|
||||
disc_parent, _ = os.path.split(disc_path)
|
||||
if not core.iso_tree_volume_path_to_node(self._volume, disc_parent):
|
||||
print "No such parent"
|
||||
return # TODO: Raise exception and/or create all missing
|
||||
# parents.
|
||||
|
||||
# Flush all ignores that may have stayed over.
|
||||
core.iso_exclude_empty()
|
||||
for exclude_path in exclude:
|
||||
core.iso_exclude_add_path(exclude_path)
|
||||
|
||||
core.iso_tree_volume_add_path(self._volume, disc_path, path)
|
||||
|
||||
def display(self):
|
||||
root = core.iso_volume_get_root(self._volume)
|
||||
core.iso_tree_print(root, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user