Exemplo n.º 1
0
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')
Exemplo n.º 2
0
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')
Exemplo n.º 3
0
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')
Exemplo n.º 4
0
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'
Exemplo n.º 5
0
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'
Exemplo n.º 6
0
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'
Exemplo n.º 7
0
def module_dependencies(name):
    path = storage.module_path(name)
    return directory_dependencies(path)
Exemplo n.º 8
0
def module_references(name):
    path = storage.module_path(name)
    return directory_references(path)
Exemplo n.º 9
0
def module_dependencies(name):
	path = storage.module_path(name)
	return directory_dependencies(path)
Exemplo n.º 10
0
def module_references(name):
	path = storage.module_path(name)
	return directory_references(path)
Exemplo n.º 11
0
def recursive_module_dependencies(mod):
    path = storage.module_path(mod)
    return recursive_dependencies(path)