def setup_environment(self, env): # removed = remove_item(env, 'CCFLAGS', ['-Wall','-Werror']) includes, return_code = \ run_shell_cmd(self.tool_name + ' --includes', "Could not execute python2.5-config") ldflags, return_code = \ run_shell_cmd(self.tool_name + ' --ldflags', "Could not execute python2.5-config") env.MergeFlags([ldflags, includes, '-DBOOST_PYTHON_NO_PY_SIGNATURES'])
def check_version(self, env): version_cmd = '%s %s' % (self.tool_name, self.version_flag) error_msg = 'Error executing "' + version_cmd + '", please make sure' \ '%s and %s are installed' % (self.name, self.tool_name) version_str, return_code = run_shell_cmd(version_cmd, error_msg) version_str = version_str.strip() correct_version = False if version_str.endswith(self.version): correct_version = True if not correct_version: print 'Need version: %s of %s, not version: %s' % \ (self.version, self.name, version_str) sys.exit(1)
def setup_environment(self, env): """ This runs the config tool and merges its result flags into the given environment. It will then check library version and headers. """ #Not current used (doesn't work with SCons instances in the list) #old_libs = set(env.get('LIBS', [])) # Cache the run of the shell command if self._config_cmd_output is None: setup_cmd = '%s %s %s' % (self.tool_name, self.cflag, self.libflag) self._config_cmd_output = ' ' for cmd in setup_cmd.split(';'): error_cmd = 'Error running: ' + cmd result, returncode = run_shell_cmd(cmd, error_cmd) if returncode != 0: print "\tError:" print "\tCould not find '%s' with tool: '%s'" \ % (self.name, self.tool_name) sys.exit(1) self._config_cmd_output += ' ' + result # Merge actuall command output # Stip out flags we don't "like" flagsToRemove = ['-O2', '-O3', '-O0', '-DNDEBUG', '-g'] for flag in flagsToRemove: self._config_cmd_output = self._config_cmd_output.replace(flag, '') env.MergeFlags([self._config_cmd_output]) # Make sure settings for dependent libraries are set self.setup_dependents(env) # Determine which libraries were added so we can check that they # link properly # Disabled because this is a bit excessive # TODO: Find a way to turn on and off this mode #self.libraries = [lib for lib in set(env['LIBS']).difference(old_libs)] self.check_environment(env)
def setup_environment(self, env): """ This runs the config tool and merges its result flags into the given environment. It will then check library version and headers. """ #Not current used (doesn't work with SCons instances in the list) #old_libs = set(env.get('LIBS', [])) # Cache the run of the shell command if self._config_cmd_output is None: setup_cmd = '%s %s %s' % (self.tool_name, self.cflag, self.libflag) self._config_cmd_output = ' ' for cmd in setup_cmd.split(';'): error_cmd = 'Error running: ' + cmd result, returncode = run_shell_cmd(cmd, error_cmd) if returncode != 0: print "\tError:" print "\tCould not find '%s' with tool: '%s'" \ % (self.name, self.tool_name) sys.exit(1) self._config_cmd_output += ' '+ result # Merge actuall command output # Stip out flags we don't "like" flagsToRemove = ['-O2', '-O3', '-O0', '-DNDEBUG', '-g'] for flag in flagsToRemove: self._config_cmd_output = self._config_cmd_output.replace(flag, '') env.MergeFlags([self._config_cmd_output]) # Make sure settings for dependent libraries are set self.setup_dependents(env) # Determine which libraries were added so we can check that they # link properly # Disabled because this is a bit excessive # TODO: Find a way to turn on and off this mode #self.libraries = [lib for lib in set(env['LIBS']).difference(old_libs)] self.check_environment(env)
def check_version(self, env): """ Ensures we have the version of the library that is desired """ version_cmd = '%s %s' % (self.tool_name, self.version_flag) error_msg = 'Error executing "' + version_cmd + '", please make sure' \ '%s and %s are installed' % (self.name, self.tool_name) version_str, return_code = run_shell_cmd(version_cmd, error_msg) version_str = version_str.strip() correct_version = False if self.strict_version and (self.version == version_str): correct_version = True elif not self.strict_version and version_str.startswith(self.version): correct_version = True if not correct_version: print 'Need version: %s of %s, not version: %s' % \ (self.version, self.name, version_str) sys.exit(1)