From 6193b4fea32cc20c269fb74a166a34d3a5ef7e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 22 Jul 2013 04:23:25 +0200 Subject: [PATCH] Add support for VMM-specific settings. --- core/Makefile | 11 +++++++++++ core/qubes.py | 9 +++++++++ core/settings-wni-Windows_NT.py | 4 ++++ 3 files changed, 24 insertions(+) create mode 100644 core/settings-wni-Windows_NT.py diff --git a/core/Makefile b/core/Makefile index 93e89520..41481354 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1,4 +1,7 @@ +OS ?= Linux + PYTHON_QUBESPATH = $(PYTHON_SITEPATH)/qubes +SETTINGS_SUFFIX = $(BACKEND_VMM)-$(OS) all: python -m compileall . @@ -19,3 +22,11 @@ endif cp notify.py[co] $(DESTDIR)$(PYTHON_QUBESPATH) cp backup.py $(DESTDIR)$(PYTHON_QUBESPATH) cp backup.py[co] $(DESTDIR)$(PYTHON_QUBESPATH) +ifneq ($(BACKEND_VMM),) + test -r settings-$(SETTINGS_SUFFIX).py && \ + cp settings-$(SETTINGS_SUFFIX).py $(DESTDIR)$(PYTHON_QUBESPATH)/settings.py + test -r settings-$(SETTINGS_SUFFIX).pyc && \ + cp settings-$(SETTINGS_SUFFIX).pyc $(DESTDIR)$(PYTHON_QUBESPATH)/settings.pyc + test -r settings-$(SETTINGS_SUFFIX).pyo && \ + cp settings-$(SETTINGS_SUFFIX).pyo $(DESTDIR)$(PYTHON_QUBESPATH)/settings.pyo +endif diff --git a/core/qubes.py b/core/qubes.py index 68b78bdd..693fffe2 100755 --- a/core/qubes.py +++ b/core/qubes.py @@ -21,6 +21,8 @@ # # +from __future__ import absolute_import + import sys import os import os.path @@ -868,6 +870,13 @@ for module_file in sorted(os.listdir(modules_dir)): continue __import__('qubes.modules.%s' % module_file[:-3]) +try: + import qubes.settings + qubes.settings.apply(system_path, vm_files, defaults) +#except ImportError: +finally: + pass + for path_key in system_path.keys(): system_path[path_key] = system_path[path_key].format( base_dir=system_path['qubes_base_dir'] diff --git a/core/settings-wni-Windows_NT.py b/core/settings-wni-Windows_NT.py new file mode 100644 index 00000000..a2739b98 --- /dev/null +++ b/core/settings-wni-Windows_NT.py @@ -0,0 +1,4 @@ +#!/usr/bin/python2 + +def apply(system_path, vm_files, defaults): + system_path['qubes_base_dir'] = 'c:/qubes'