Add the beginnings of a high level API to isofs. Currently only does

initialization and getting/setting volume attributes.
This commit is contained in:
Dave 2007-04-13 04:56:31 +00:00
parent 24730f52d1
commit 0ae442220a
3 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,2 @@
from defines import *
from isofs import IsoFS

View File

@ -0,0 +1,9 @@
# The automatic code generator does not wrap enums into python. As
# isofs has only two enum values publicly defined, they are hardcoded
# here.
# from enum ecma119_extension_flag
ECMA119_ROCKRIDGE = 1
ECMA119_JOLIET = 2
__all__ = ['ECMA119_ROCKRIDGE', 'ECMA119_JOLIET']

View File

@ -0,0 +1,30 @@
# High level interface to the isofs library.
import core
import defines
def _wrap_volume_property(var_name, core_setter):
def get(self):
return getattr(self, var_name)
def set(self, value):
setattr(self, var_name, value)
core_setter(self._volume, value)
return property(get, set)
class IsoFS(object):
def __init__(self, volume_id='', publisher_id='',
data_preparer_id=''):
self._volume_id = volume_id
self._publisher_id = publisher_id
self._data_preparer_id = data_preparer_id
self._volume = core.iso_volume_new(
volume_id, publisher_id, data_preparer_id)
self._volset = core.iso_volset_new(self._volume, volume_id)
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)