Commit 313184b6 authored by Julien Muchembled's avatar Julien Muchembled

default: only set default 'location' option if there's an install script

parent 90a2ee51
...@@ -227,11 +227,6 @@ class Script(EnvironMixin): ...@@ -227,11 +227,6 @@ class Script(EnvironMixin):
self.buildout = buildout self.buildout = buildout
self.name = name self.name = name
self.logger = logging.getLogger('SlapOS build of %s' % self.name) self.logger = logging.getLogger('SlapOS build of %s' % self.name)
try:
self.options['location'] = self.options['location'].strip()
except KeyError:
self.options['location'] = os.path.join(
buildout['buildout']['parts-directory'], self.name)
missing = True missing = True
keys = 'init', 'install', 'update' keys = 'init', 'install', 'update'
for option in keys: for option in keys:
...@@ -247,17 +242,21 @@ class Script(EnvironMixin): ...@@ -247,17 +242,21 @@ class Script(EnvironMixin):
self.keep_on_error = True self.keep_on_error = True
else: else:
self.keep_on_error = False self.keep_on_error = False
if self._install and 'location' not in options:
options['location'] = os.path.join(
buildout['buildout']['parts-directory'], self.name)
EnvironMixin.__init__(self, False) EnvironMixin.__init__(self, False)
if self._init: if self._init:
self._exec(self._init) self._exec(self._init)
def _exec(self, script): def _exec(self, script):
options = self.options options = self.options
exec(script, dict(GLOBALS, g = dict(GLOBALS, self=self, options=options)
self=self, try:
options=options, g['location'] = options['location']
location=options['location'], except KeyError:
)) pass
exec(script, g)
def install(self): def install(self):
if not self._install: if not self._install:
......
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