[jhbuild] add 'conditions' to the config file
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] add 'conditions' to the config file
- Date: Wed, 29 Jan 2014 18:56:00 +0000 (UTC)
commit e2f0f4ed0b69d35778922bed54a48fdc71946c68
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Dec 20 16:45:15 2013 -0500
add 'conditions' to the config file
This is a set() that holds the condition flags for this run.
It is pre-seeded with some flags according to what platform you're
running on (by way of inspecting sys.platform)
It is intended that people should update the conditions in their
jhbuildrc files like so:
conditions.add('condition')
or
conditions.discard('condition')
But they can also be replaced outright, as long as it remains a set.
Future commits will introduce behaviour that depends on this setting.
https://bugzilla.gnome.org/show_bug.cgi?id=720839
jhbuild/config.py | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/config.py b/jhbuild/config.py
index 4b8824c..5c9a708 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -63,7 +63,7 @@ _known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
'print_command_pattern', 'static_analyzer',
'module_static_analyzer', 'static_analyzer_template',
'static_analyzer_outputdir', 'check_sysdeps', 'system_prefix',
- 'help_website',
+ 'help_website', 'conditions'
]
env_prepends = {}
@@ -146,6 +146,28 @@ def parse_relative_time(s):
else:
raise ValueError
+def get_default_conditions():
+ # the default conditions set. We determine which set to used based on
+ # the first item in the list which is a prefix of 'sys.platform', which
+ # is a name like 'linux2', 'darwin', 'freebsd10', etc.
+ #
+ # if we watch to match (eg 'freebsd10' more closely than other versions
+ # of 'freebsd') then we just need to make sure the more-specific one
+ # comes first in the list
+ conditions_sets = [
+ ('linux', ['linux', 'wayland', 'udev', 'x11']),
+ ('freebsd', ['freebsd', 'x11']),
+
+ # this must be left here so that at least one will be found
+ ('', ['x11'])
+ ]
+
+ for prefix, flags in conditions_sets:
+ if sys.platform.startswith(prefix):
+ return set(flags)
+
+ # we will only hit this if someone removed the '' entry above
+ raise FatalError('failed to find matching condition set...')
class Config:
_orig_environ = None
@@ -224,6 +246,8 @@ class Config:
else:
self._config['__file__'] = new_config
self.filename = new_config
+
+ self._config['conditions'] = get_default_conditions()
self.load(filename)
self.setup_env()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]