Commit 95021272 authored by Antoine Catton's avatar Antoine Catton

Add ability to override environment

parent a4e019bb
...@@ -65,7 +65,7 @@ class Recipe(object): ...@@ -65,7 +65,7 @@ class Recipe(object):
'PREFIX': self.options['location'], 'PREFIX': self.options['location'],
'RUBYLIB': os.environ.get('RUBYLIB', ''), 'RUBYLIB': os.environ.get('RUBYLIB', ''),
} }
return { env = {
'GEM_HOME': '%(PREFIX)s/lib/ruby/gems/1.8' % s, 'GEM_HOME': '%(PREFIX)s/lib/ruby/gems/1.8' % s,
'RUBYLIB': self._join_paths( 'RUBYLIB': self._join_paths(
'%(RUBYLIB)s', '%(RUBYLIB)s',
...@@ -78,6 +78,17 @@ class Recipe(object): ...@@ -78,6 +78,17 @@ class Recipe(object):
'%(PREFIX)s/bin', '%(PREFIX)s/bin',
) % s, ) % s,
} }
try:
env_override = self.options.get('environment', '')
env = {k: v % env
for k, v in [[i.strip() for i in line.split('=', 1)]
for line in env_override.split('\n')
if line.strip()]
}
except ValueError: # Unpacking impossible
self.log.error("Every environment line should contain a '=' sign")
zc.buildout.UserError('Configuration error')
return env
def _get_latest_rubygems(self): def _get_latest_rubygems(self):
if self.version: if self.version:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment