def get_library_extension(): if system.os() == 'windows': return ".dll" elif system.os() == 'linux': return ".so" elif system.os() == 'darwin': return ".dylib" else: return ""
def reset_library_path(env): if env.has_key('PREVIOUS_LIBRARY_PATH'): if system.os() == 'windows': var_name = 'PATH' elif system.os() == 'darwin': var_name = 'DYLD_LIBRARY_PATH' else: var_name = 'LD_LIBRARY_PATH' os.environ[var_name] = env['PREVIOUS_LIBRARY_PATH']
def set_library_path(env): if system.os() == 'windows': var_name = 'PATH' elif system.os() == 'darwin': var_name = 'DYLD_LIBRARY_PATH' else: var_name = 'LD_LIBRARY_PATH' env['PREVIOUS_LIBRARY_PATH'] = '' if os.environ.has_key(var_name): env['PREVIOUS_LIBRARY_PATH'] = os.environ[var_name] os.environ[var_name] = env['ENV'][var_name]
def add_to_library_path(env, new_path): if system.os() == 'windows': var_name = 'PATH' elif system.os() == 'darwin': var_name = 'DYLD_LIBRARY_PATH' else: var_name = 'LD_LIBRARY_PATH' if env['ENV'].has_key(var_name): env['ENV'][var_name] = '%s%s%s' % (new_path, os.pathsep, env['ENV'][var_name]) else: env['ENV'][var_name] = new_path
def process_return_code(retcode): if retcode == 0: status = 'OK' else: if system.os() == 'windows': if retcode < 0: status = 'CRASHED' else: status = 'FAILED' else: if retcode > 128: status = 'CRASHED' else: status = 'FAILED' return status
def get_executable_extension(): if system.os() == 'windows': return ".exe" else: return ""
def get_escaped_path(path): if system.os() == 'windows': return path.replace("\\", "\\\\") else: return path