Delay resolving system_path['qubes_base_dir']

So changes made by os/vmm-specific settings would be taken into account.
This commit is contained in:
Marek Marczykowski-Górecki 2013-07-22 04:22:01 +02:00
parent f6835346d4
commit 80c89cc91c

View File

@ -53,11 +53,11 @@ system_path = {
'qubes_base_dir': qubes_base_dir,
'qubes_appvms_dir': qubes_base_dir + '/appvms',
'qubes_templates_dir': qubes_base_dir + '/vm-templates',
'qubes_servicevms_dir': qubes_base_dir + '/servicevms',
'qubes_store_filename': qubes_base_dir + '/qubes.xml',
'qubes_kernels_base_dir': qubes_base_dir + '/vm-kernels',
'qubes_appvms_dir': '{base_dir}/appvms',
'qubes_templates_dir': '{base_dir}/vm-templates',
'qubes_servicevms_dir': '{base_dir}/servicevms',
'qubes_store_filename': '{base_dir}/qubes.xml',
'qubes_kernels_base_dir': '{base_dir}/vm-kernels',
# qubes_icon_dir is obsolete
# use QIcon.fromTheme() where applicable
@ -243,11 +243,6 @@ class QubesVmLabel(object):
self.icon = '{}-{}'.format(('dispvm' if dispvm else 'appvm'), name)
# self.icon_path is obsolete
# use QIcon.fromTheme(label.icon) where applicable
self.icon_path = os.path.join(
system_path['qubes_icon_dir'], self.icon) + ".png"
def __repr__(self):
return '{}({!r}, {!r}, {!r}, dispvm={!r})'.format(
self.__class__.__name__,
@ -256,6 +251,11 @@ class QubesVmLabel(object):
self.name,
self.dispvm)
# self.icon_path is obsolete
# use QIcon.fromTheme(label.icon) where applicable
@property
def icon_path(self):
return os.path.join(system_path['qubes_icon_dir'], self.icon) + ".png"
def register_qubes_vm_class(vm_class):
QubesVmClasses[vm_class.__name__] = vm_class
@ -268,7 +268,7 @@ class QubesVmCollection(dict):
A collection of Qubes VMs indexed by Qubes id (qid)
"""
def __init__(self, store_filename=system_path["qubes_store_filename"]):
def __init__(self, store_filename=None):
super(QubesVmCollection, self).__init__()
self.default_netvm_qid = None
self.default_fw_netvm_qid = None
@ -276,6 +276,8 @@ class QubesVmCollection(dict):
self.default_kernel = None
self.updatevm_qid = None
self.qubes_store_filename = store_filename
if not store_filename:
self.qubes_store_filename = system_path["qubes_store_filename"]
self.clockvm_qid = None
self.qubes_store_file = None
@ -866,4 +868,9 @@ for module_file in sorted(os.listdir(modules_dir)):
continue
__import__('qubes.modules.%s' % module_file[:-3])
for path_key in system_path.keys():
system_path[path_key] = system_path[path_key].format(
base_dir=system_path['qubes_base_dir']
)
# vim:sw=4:et: