def ready_indexed_module(name): if storage.module_compiled(name): print utility.color(' - already compiled', 'green') else: path = storage.module_path(name) build_directory(path) prepare_headers(name) print utility.color(' - compiled module: ' + name, 'green')
def install(context): build(None) name = os.path.abspath('.').split('/')[-1] if os.path.exists('sources/main.c'): shutil.copy('build/bin/' + name, '/usr/local/bin/' + name) else: dest = storage.module_path(name) shutil.copytree('.', dest) storage.index(name, 'none')
def prepare_headers(name): root = storage.module_path(name) baseheaders = root + '/build/headers/kit' headers = baseheaders + '/' + name for path in utility.headers_under(root): if path.find('build') == 0: continue dest = path.replace(root + '/', '') dest = '/'.join(dest.split('/')[1:]) if not os.path.exists(headers): os.makedirs(headers) shutil.copy(path, headers + '/' + dest) if path.replace(root + '/sources/', '') == name + '.h': shutil.copy(path, baseheaders) print ' - prepared headers'
def prepare_headers(name): root = storage.module_path(name) baseheaders = root + '/build/headers/kit' headers = baseheaders + '/' + name for path in utility.headers_under(root): # don't duplicate if already prepared if path.find('build') == 0: continue # move file dest = path.replace(root + '/', '') dest = '/'.join(dest.split('/')[1:]) if not os.path.exists(headers): os.makedirs(headers) shutil.copy(path, headers + '/' + dest) # make `#include <kit/name.h>` function as `#include <kit/name/{api.h, # name.h}>` short = path.replace(root + '/sources/', '') if short in ['api.h', 'api.hh', name + '.h', name + '.hh']: shutil.copy( path, baseheaders + '/' + name + short[short.find('.'):]) print ' - prepared headers'
def module_dependencies(name): path = storage.module_path(name) return directory_dependencies(path)
def module_references(name): path = storage.module_path(name) return directory_references(path)
def recursive_module_dependencies(mod): path = storage.module_path(mod) return recursive_dependencies(path)