[sabayon] Remove hard-coded gconf source strings, add gconf sources to config.py.in for easier customization/p
- From: Scott Balneaves <sbalneav src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [sabayon] Remove hard-coded gconf source strings, add gconf sources to config.py.in for easier customization/p
- Date: Thu, 4 Feb 2010 17:40:34 +0000 (UTC)
commit 30782bc655af8b096420b4e19843e6577460f19f
Author: Scott Balneaves <sbalneav ltsp org>
Date: Thu Feb 4 11:39:01 2010 -0600
Remove hard-coded gconf source strings, add gconf sources to config.py.in for easier customization/patching by distros
admin-tool/sabayon-apply | 8 ++++----
lib/config.py.in | 15 ++++++++++++---
lib/sources/gconfsource.py | 38 +++++++++++++++++++-------------------
lib/sources/paneldelegate.py | 12 ++++++------
4 files changed, 41 insertions(+), 32 deletions(-)
---
diff --git a/admin-tool/sabayon-apply b/admin-tool/sabayon-apply
index 78e8407..7eb7021 100755
--- a/admin-tool/sabayon-apply
+++ b/admin-tool/sabayon-apply
@@ -129,10 +129,10 @@ if __name__ == '__main__':
#
try:
- shutil.rmtree (os.path.join (util.get_home_dir (), ".gconf.xml.defaults"), True)
- shutil.rmtree (os.path.join (util.get_home_dir (), ".gconf.xml.mandatory"), True)
- os.mkdir (os.path.join (util.get_home_dir (), ".gconf.xml.defaults"))
- os.mkdir (os.path.join (util.get_home_dir (), ".gconf.xml.mandatory"))
+ shutil.rmtree (os.path.join (util.get_home_dir (), GCONF_DEFAULTS_SOURCE), True)
+ shutil.rmtree (os.path.join (util.get_home_dir (), GCONF_MANDATORY_SOURCE), True)
+ os.mkdir (os.path.join (util.get_home_dir (), GCONF_DEFAULTS_SOURCE))
+ os.mkdir (os.path.join (util.get_home_dir (), GCONF_MANDATORY_SOURCE))
except:
pass
diff --git a/lib/config.py.in b/lib/config.py.in
index 565a893..d170cba 100755
--- a/lib/config.py.in
+++ b/lib/config.py.in
@@ -47,6 +47,15 @@ XEPHYR_USR1_TIMEOUT = 10
#
PROTOTYPE_USER = "@PROTOTYPE_USER@"
+#
+# default, mandatory, and mandatory-alt gconf key trees in users
+# home directory.
+#
+
+GCONF_DEFAULT_SOURCE = ".gconf.xml.defaults"
+GCONF_MANDATORY_SOURCE = ".gconf.xml.mandatory"
+GCONF_MANDATORY_ALT_SOURCE = ".gconf.xml.mandatory-alt"
+
# FIXME: should all of these be options passed to the "configure" script?
DEFAULT_PATH = "/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin"
DEFAULT_SHELL = "/bin/bash"
@@ -130,9 +139,9 @@ DIRECTORIES_TO_IGNORE_PROFILE = [
#
DIRECTORIES_TO_IGNORE = DIRECTORIES_TO_IGNORE_PROFILE + [
".gconf",
- ".gconf.xml.defaults",
- ".gconf.xml.mandatory",
- ".gconf.xml.mandatory-alt"
+ GCONF_DEFAULT_SOURCE,
+ GCONF_MANDATORY_SOURCE,
+ GCONF_MANDATORY_ALT_SOURCE,
]
#
diff --git a/lib/sources/gconfsource.py b/lib/sources/gconfsource.py
index da41bed..5a88985 100755
--- a/lib/sources/gconfsource.py
+++ b/lib/sources/gconfsource.py
@@ -133,36 +133,36 @@ class GConfSource (userprofile.ProfileSource):
self.enforce_mandatory = True
def get_path_description (self, path):
- if path == ".gconf.xml.defaults":
+ if path == GCONF_DEFAULTS_SOURCE:
return _("Default GConf settings")
- elif path == ".gconf.xml.mandatory":
+ elif path == GCONF_MANDATORY_SOURCE:
return _("Mandatory GConf settings")
else:
return path
def get_committing_client_and_address (self, mandatory):
- """Get a GConfClient using either .gconf.xml.defaults or
- .gconf.xml.mandatory (in the temporary profile location)
+ """Get a GConfClient using either GCONF_DEFAULTS_SOURCE or
+ GCONF_MANDATORY_SOURCE (in the temporary profile location)
as its source.
mandatory: whether to get the mandatory or defaults source
"""
if not mandatory:
if not self.defaults_client:
- (client, address) = get_client_and_address_for_path (os.path.join (self.home_dir, ".gconf.xml.defaults"))
+ (client, address) = get_client_and_address_for_path (os.path.join (self.home_dir, GCONF_DEFAULTS_SOURCE))
self.defaults_client = client
self.defaults_address = address
return (self.defaults_client, self.defaults_address)
else:
if self.enforce_mandatory:
if not self.mandatory_client:
- (client, address) = get_client_and_address_for_path (os.path.join (self.home_dir, ".gconf.xml.mandatory"))
+ (client, address) = get_client_and_address_for_path (os.path.join (self.home_dir, GCONF_MANDATORY_SOURCE))
self.mandatory_client = client
self.mandatory_address = address
return (self.mandatory_client, self.mandatory_address)
else:
if not self.mandatory_alt_client:
- (client, address) = get_client_and_address_for_path (os.path.join (self.home_dir, ".gconf.xml.mandatory-alt"))
+ (client, address) = get_client_and_address_for_path (os.path.join (self.home_dir, GCONF_MANDATORY_ALT_SOURCE))
self.mandatory_alt_client = client
self.mandatory_alt_address = address
return (self.mandatory_alt_client, self.mandatory_alt_address)
@@ -243,15 +243,15 @@ class GConfSource (userprofile.ProfileSource):
time.sleep (2)
- if os.path.exists (os.path.join (self.home_dir, ".gconf.xml.defaults")):
- self.storage.add (".gconf.xml.defaults", self.home_dir, self.name)
+ if os.path.exists (os.path.join (self.home_dir, GCONF_DEFAULTS_SOURCE)):
+ self.storage.add (GCONF_DEFAULTS_SOURCE, self.home_dir, self.name)
if self.enforce_mandatory:
- mandatory_src = ".gconf.xml.mandatory"
+ mandatory_src = GCONF_MANDATORY_SOURCE
else:
- mandatory_src = ".gconf.xml.mandatory-alt"
+ mandatory_src = GCONF_MANDATORY_ALT_SOURCE
if os.path.exists (os.path.join (self.home_dir, mandatory_src)):
- self.storage.add (".gconf.xml.mandatory", self.home_dir, self.name, src_path = mandatory_src)
+ self.storage.add (GCONF_MANDATORY_SOURCE, self.home_dir, self.name, src_path = mandatory_src)
def set_enforce_mandatory (self, enforce):
if enforce == self.enforce_mandatory:
@@ -304,18 +304,18 @@ class GConfSource (userprofile.ProfileSource):
storage_contents = self.storage.list (self.name)
- if ("GConf", ".gconf.xml.defaults") in storage_contents:
- self.storage.extract (".gconf.xml.defaults", self.home_dir, True)
- default_path = "xml:readonly:" + os.path.join (self.home_dir, ".gconf.xml.defaults");
+ if ("GConf", GCONF_DEFAULTS_SOURCE) in storage_contents:
+ self.storage.extract (GCONF_DEFAULTS_SOURCE, self.home_dir, True)
+ default_path = "xml:readonly:" + os.path.join (self.home_dir, GCONF_DEFAULTS_SOURCE);
if is_sabayon_session:
- default_path = "xml:readonly:" + os.path.join (self.home_dir, ".gconf.xml.mandatory-alt") + "\n" + default_path
+ default_path = "xml:readonly:" + os.path.join (self.home_dir, GCONF_MANDATORY_ALT_SOURCE) + "\n" + default_path
write_path_file (os.path.join (self.home_dir, ".gconf.path.defaults"), default_path)
- if ("GConf", ".gconf.xml.mandatory") in storage_contents:
- self.storage.extract (".gconf.xml.mandatory", self.home_dir, True)
+ if ("GConf", GCONF_MANDATORY_SOURCE) in storage_contents:
+ self.storage.extract (GCONF_MANDATORY_SOURCE, self.home_dir, True)
write_path_file (os.path.join (self.home_dir, ".gconf.path.mandatory"),
- "xml:readonly:" + os.path.join (self.home_dir, ".gconf.xml.mandatory"))
+ "xml:readonly:" + os.path.join (self.home_dir, GCONF_MANDATORY_SOURCE))
# FIXME: perhaps just kill -HUP it? It would really just be better
# if we could guarantee that there wasn't a gconfd already
diff --git a/lib/sources/paneldelegate.py b/lib/sources/paneldelegate.py
index 6087f5c..8aa15cc 100755
--- a/lib/sources/paneldelegate.py
+++ b/lib/sources/paneldelegate.py
@@ -185,7 +185,7 @@ class PanelDelegate (userprofile.SourceDelegate):
def _copy_tree (self, dir):
if not self.gconf_client.dir_exists(dir):
(src_client, src_address) = gconfsource.get_client_and_address_for_path (os.path.join (util.get_home_dir (), '.gconf'))
- (dst_client, dst_address) = gconfsource.get_client_and_address_for_path (os.path.join (util.get_home_dir (), '.gconf.xml.defaults'))
+ (dst_client, dst_address) = gconfsource.get_client_and_address_for_path (os.path.join (util.get_home_dir (), GCONF_DEFAULTS_SOURCE))
copy_dir (src_client, dst_client, dst_address, dir)
class PanelToplevel (PanelThing):
@@ -575,14 +575,14 @@ def run_unit_tests ():
if not mandatory:
if not self.defaults_client:
(client, address) = gconfsource.get_client_and_address_for_path (
- os.path.join (self.temp_path, ".gconf.xml.defaults"))
+ os.path.join (self.temp_path, GCONF_DEFAULTS_SOURCE))
self.defaults_client = client
self.defaults_address = address
return (self.defaults_client, self.defaults_address)
else:
if not self.mandatory_client:
(client, address) = gconfsource.get_client_and_address_for_path (
- os.path.join (self.temp_path, ".gconf.xml.mandatory"))
+ os.path.join (self.temp_path, GCONF_MANDATORY_SOURCE))
self.mandatory_client = client
self.mandatory_address = address
return (self.mandatory_client, self.mandatory_address)
@@ -686,8 +686,8 @@ def run_unit_tests ():
subprocess.call (["gconftool-2", "--shutdown"])
time.sleep (1)
- assert os.access (os.path.join (temp_path, ".gconf.xml.defaults/apps/panel/general/%gconf.xml"), os.F_OK)
- assert os.access (os.path.join (temp_path, ".gconf.xml.defaults/apps/panel/toplevels/foo/%gconf.xml"), os.F_OK)
+ assert os.access (os.path.join (temp_path, GCONF_DEFAULTS_SOURCE + "/apps/panel/general/%gconf.xml"), os.F_OK)
+ assert os.access (os.path.join (temp_path, GCONF_DEFAULTS_SOURCE + "/apps/panel/toplevels/foo/%gconf.xml"), os.F_OK)
changes = []
@@ -742,7 +742,7 @@ def run_unit_tests ():
subprocess.call (["gconftool-2", "--shutdown"])
time.sleep (1)
- assert not os.access (os.path.join (temp_path, ".gconf.xml.defaults/apps/panel/toplevels/foo/%gconf.xml"), os.F_OK)
+ assert not os.access (os.path.join (temp_path, GCONF_DEFAULTS_SOURCE + "/apps/panel/toplevels/foo/%gconf.xml"), os.F_OK)
# Bye, bye cruft
subprocess.call (["gconftool-2", "--recursive-unset", "%s/toplevels/foo" % PANEL_KEY_BASE])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]