Commit b422c016 authored by Julien Muchembled's avatar Julien Muchembled

Do not do in __init__ what is fine to do in install

parent 9bf0241a
...@@ -119,7 +119,6 @@ class Recipe(object): ...@@ -119,7 +119,6 @@ class Recipe(object):
if '@@LOCATION@@' in v: if '@@LOCATION@@' in v:
options[k] = v.replace('@@LOCATION@@', location) options[k] = v.replace('@@LOCATION@@', location)
self.original_environment = os.environ.copy()
for variable in options.get('environment', '').splitlines(): for variable in options.get('environment', '').splitlines():
if variable.strip(): if variable.strip():
try: try:
...@@ -127,16 +126,6 @@ class Recipe(object): ...@@ -127,16 +126,6 @@ class Recipe(object):
self.environ[key.strip()] = value self.environ[key.strip()] = value
except ValueError: except ValueError:
raise UserError('Invalid environment variable definition: %s' % variable) raise UserError('Invalid environment variable definition: %s' % variable)
# Add prefix to PATH, CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS
if self.buildout_prefix != '':
self.environ['PATH'] = '%s/bin:%s' % (self.buildout_prefix, self.environ.get('PATH', '/usr/bin'))
self.environ['CPPFLAGS'] = '-I%s/include %s' % (self.buildout_prefix, self.environ.get('CPPFLAGS', ''))
self.environ['CFLAGS'] = '-I%s/include %s' % (self.buildout_prefix, self.environ.get('CFLAGS', ''))
self.environ['CXXFLAGS'] = '-I%s/include %s' % (self.buildout_prefix, self.environ.get('CXXFLAGS', ''))
self.environ['LDFLAGS'] = '-L%s/lib %s' % (self.buildout_prefix, self.environ.get('LDFLAGS', ''))
if options.get('configure-command') == 'cygport':
self.environ.setdefault('CYGCONF_PREFIX', options['prefix'])
def augmented_environment(self): def augmented_environment(self):
"""Returns a dictionary containing the current environment variables """Returns a dictionary containing the current environment variables
...@@ -269,6 +258,14 @@ class Recipe(object): ...@@ -269,6 +258,14 @@ class Recipe(object):
for key in self.environ: for key in self.environ:
self.environ[key] %= os.environ self.environ[key] %= os.environ
# Add prefix to PATH, CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS
if self.buildout_prefix:
self.environ['PATH'] = '%s/bin:%s' % (self.buildout_prefix, self.environ.get('PATH', '/usr/bin'))
self.environ['CPPFLAGS'] = '-I%s/include %s' % (self.buildout_prefix, self.environ.get('CPPFLAGS', ''))
self.environ['CFLAGS'] = '-I%s/include %s' % (self.buildout_prefix, self.environ.get('CFLAGS', ''))
self.environ['CXXFLAGS'] = '-I%s/include %s' % (self.buildout_prefix, self.environ.get('CXXFLAGS', ''))
self.environ['LDFLAGS'] = '-L%s/lib %s' % (self.buildout_prefix, self.environ.get('LDFLAGS', ''))
make_cmd = self.options.get('make-binary', 'make').strip() make_cmd = self.options.get('make-binary', 'make').strip()
make_options = ' '.join(self.options.get('make-options', '').split()) make_options = ' '.join(self.options.get('make-options', '').split())
make_targets = ' '.join(self.options.get('make-targets', 'install').split()) make_targets = ' '.join(self.options.get('make-targets', 'install').split())
...@@ -276,6 +273,9 @@ class Recipe(object): ...@@ -276,6 +273,9 @@ class Recipe(object):
configure_options = self.options.get('configure-options', '').split() configure_options = self.options.get('configure-options', '').split()
configure_cmd = self.options.get('configure-command', '').strip() configure_cmd = self.options.get('configure-command', '').strip()
if configure_cmd == 'cygport':
self.environ.setdefault('CYGCONF_PREFIX', self.options['prefix'])
if not configure_cmd: if not configure_cmd:
# Default to using basic configure script. # Default to using basic configure script.
configure_cmd = './configure' configure_cmd = './configure'
......
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