Commit ab661f01 authored by Julien Muchembled's avatar Julien Muchembled

default: execute 'init' after the 'location' option is automatically set

This makes 'init' able to set other options that depend on location.
It's still free to change options['location'] if the part is not shared.
parent 9b17086a
Pipeline #18895 passed with stage
in 0 seconds
...@@ -226,23 +226,24 @@ class Script(EnvironMixin): ...@@ -226,23 +226,24 @@ class Script(EnvironMixin):
else: else:
self.keep_on_error = False self.keep_on_error = False
EnvironMixin.__init__(self, False) EnvironMixin.__init__(self, False)
if self._init:
self._exec(self._init)
shared = Shared(buildout, name, options) shared = Shared(buildout, name, options)
if self._update: if self._update:
shared.assertNotShared("option 'update' can't be set") shared.assertNotShared("option 'update' can't be set")
if self._install: if self._install:
location = options.get('location') if not options.get('location'):
if location:
shared.assertNotShared("option 'location' can't be set")
shared.location = location
else:
options['location'] = shared.location options['location'] = shared.location
if self._init:
self._exec(self._init)
if shared.location != options['location']:
shared.assertNotShared("option 'location' can't be set")
shared.location = options['location']
shared.keep_on_error = True shared.keep_on_error = True
shared.mkdir_location = False shared.mkdir_location = False
self._shared = shared self._shared = shared
else: else:
shared.assertNotShared("option 'install' must be set") shared.assertNotShared("option 'install' must be set")
if self._init:
self._exec(self._init)
def _exec(self, script): def _exec(self, script):
options = self.options options = self.options
...@@ -251,7 +252,6 @@ class Script(EnvironMixin): ...@@ -251,7 +252,6 @@ class Script(EnvironMixin):
g['location'] = options['location'] g['location'] = options['location']
except KeyError: except KeyError:
pass pass
linecache.cache[self.name] = ( linecache.cache[self.name] = (
len(script), len(script),
None, None,
......
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