diff -r abc1014d5ad6 autobuild/autobuild_tool_build.py --- a/autobuild/autobuild_tool_build.py Tue Mar 15 14:46:44 2011 -0700 +++ b/autobuild/autobuild_tool_build.py Thu Mar 17 13:54:00 2011 -0700 @@ -147,8 +147,8 @@ else: logger.info('no build executable defined; doing nothing') return 0 - logger.info('executing build command %s', build_executable) + logger.info('executing build command %s', build_executable.__str__(extra_arguments)) if not dry_run: - return build_executable(extra_arguments) + return build_executable(extra_arguments, common.get_autobuild_environment()) else: return 0 diff -r abc1014d5ad6 autobuild/autobuild_tool_configure.py --- a/autobuild/autobuild_tool_configure.py Tue Mar 15 14:46:44 2011 -0700 +++ b/autobuild/autobuild_tool_configure.py Thu Mar 17 13:54:00 2011 -0700 @@ -123,8 +123,8 @@ else: logger.info('no configure executable defined; doing nothing') return 0 - logger.info('executing configure command %s', configure_executable) + logger.info('executing configure command %s', configure_executable.__str__(extra_arguments)) if not dry_run: - return configure_executable(extra_arguments) + return configure_executable(extra_arguments, common.get_autobuild_environment()) else: return 0 diff -r abc1014d5ad6 autobuild/common.py --- a/autobuild/common.py Tue Mar 15 14:46:44 2011 -0700 +++ b/autobuild/common.py Thu Mar 17 13:54:00 2011 -0700 @@ -103,6 +103,13 @@ """ scp = find_executable(['pscp', 'scp'], ['.exe']) return scp + +def get_autobuild_environment(): + """ + Return an environment under which to execute autobuild subprocesses. + """ + return dict(os.environ, AUTOBUILD=os.environ.get( + 'AUTOBUILD', get_autobuild_executable_path())) def get_default_install_cache_dir(): """ diff -r abc1014d5ad6 autobuild/executable.py --- a/autobuild/executable.py Tue Mar 15 14:46:44 2011 -0700 +++ b/autobuild/executable.py Thu Mar 17 13:54:00 2011 -0700 @@ -66,24 +66,14 @@ self.arguments = arguments self.parent = parent - def __call__(self, options=[]): - actual_command = self.get_command() - if actual_command is None: - raise ExecutableError('no command specified') - all_arguments = [actual_command] - all_arguments.extend(self.get_options()) - all_arguments.extend(options) - all_arguments.extend(self.get_arguments()) - - autobuild_env = dict(os.environ, AUTOBUILD=os.environ.get('AUTOBUILD',common.get_autobuild_executable_path())) - - return subprocess.call(' '.join(all_arguments), shell=True, env=autobuild_env) + def __call__(self, options=[], environment=os.environ): + return subprocess.call(' '.join(self._get_all_arguments(options)), shell=True, env=environment) - def __str__(self): - all_arguments = [self.get_command()] - all_arguments.extend(self.get_options()) - all_arguments.extend(self.get_arguments()) - return ' '.join(all_arguments) + def __str__(self, options=[]): + try: + return ' '.join(self._get_all_arguments(options)) + except: + return 'INVALID EXECUTABLE!' def get_arguments(self): """ @@ -117,4 +107,13 @@ return self.parent.get_command() else: None - + + def _get_all_arguments(self, options): + actual_command = self.get_command() + if actual_command is None: + raise ExecutableError('no command specified') + all_arguments = [actual_command] + all_arguments.extend(self.get_options()) + all_arguments.extend(options) + all_arguments.extend(self.get_arguments()) + return all_arguments