mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-24 17:31:09 +00:00
Script-specific variables win over package variables no matter which store they come from
This commit is contained in:
parent
4336f7442a
commit
4f7a5232a2
@ -70,8 +70,8 @@ class UDTConfig(object):
|
|||||||
keys are prefixed with the script name, falling back to UBUNTUTOOLS for
|
keys are prefixed with the script name, falling back to UBUNTUTOOLS for
|
||||||
package-wide keys.
|
package-wide keys.
|
||||||
|
|
||||||
Store Priority: Environment variables, user conf, system conf
|
|
||||||
Variable Priority: PREFIX_KEY, UBUNTUTOOLS_KEY, compat_keys
|
Variable Priority: PREFIX_KEY, UBUNTUTOOLS_KEY, compat_keys
|
||||||
|
Store Priority: Environment variables, user conf, system conf
|
||||||
|
|
||||||
Historical variable names can be supplied via compat_keys, no prefix is
|
Historical variable names can be supplied via compat_keys, no prefix is
|
||||||
applied to them.
|
applied to them.
|
||||||
@ -84,8 +84,8 @@ class UDTConfig(object):
|
|||||||
keys.append('UBUNTUTOOLS_' + key)
|
keys.append('UBUNTUTOOLS_' + key)
|
||||||
keys += compat_keys
|
keys += compat_keys
|
||||||
|
|
||||||
for store in (os.environ, self.config):
|
|
||||||
for k in keys:
|
for k in keys:
|
||||||
|
for store in (os.environ, self.config):
|
||||||
if k in store:
|
if k in store:
|
||||||
value = store[k]
|
value = store[k]
|
||||||
if value in ('yes', 'no'):
|
if value in ('yes', 'no'):
|
||||||
|
@ -108,16 +108,15 @@ REPEAT=yes
|
|||||||
os.environ['UBUNTUTOOLS_BUILDER'] = 'baz'
|
os.environ['UBUNTUTOOLS_BUILDER'] = 'baz'
|
||||||
self.assertEqual(self.get_value('BUILDER'), 'baz')
|
self.assertEqual(self.get_value('BUILDER'), 'baz')
|
||||||
|
|
||||||
def test_any_environment_precedence(self):
|
def test_general_environment_specific_config_precedence(self):
|
||||||
config_files['user'] = "TEST_BUILDER=bar"
|
config_files['user'] = "TEST_BUILDER=bar"
|
||||||
os.environ['UBUNTUTOOLS_BUILDER'] = 'foo'
|
os.environ['UBUNTUTOOLS_BUILDER'] = 'foo'
|
||||||
self.assertEqual(self.get_value('BUILDER'), 'foo')
|
self.assertEqual(self.get_value('BUILDER'), 'bar')
|
||||||
|
|
||||||
def test_compat_environment_precedence(self):
|
def test_compat_keys(self):
|
||||||
config_files['user'] = "TEST_BUILDER=bar"
|
config_files['user'] = 'COMPATFOOBAR=bar'
|
||||||
os.environ['BUILDER'] = 'baz'
|
self.assertEqual(self.get_value('QUX', compat_keys=['COMPATFOOBAR']),
|
||||||
self.assertEqual(self.get_value('BUILDER', compat_keys=['BUILDER']),
|
'bar')
|
||||||
'baz')
|
|
||||||
|
|
||||||
def test_boolean(self):
|
def test_boolean(self):
|
||||||
config_files['user'] = "TEST_BOOLEAN=yes"
|
config_files['user'] = "TEST_BOOLEAN=yes"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user