Пример #1
0
def install():
    build()

    install_builder = None

    if options.enable_libkunquat:
        install_libkunquat(install_builder, options.prefix,
                           options.enable_libkunquat_dev)

    if options.enable_examples:
        install_examples(install_builder, options.prefix)

    install_share(install_builder, options.prefix)

    if options.enable_python_bindings:
        python_cmd = command.PythonCommand()
        args = ['py-setup.py', 'install', '--prefix={}'.format(options.prefix)]
        if not options.enable_export:
            args.append('--disable-export')
        if not options.enable_player:
            args.append('--disable-player')
        if not options.enable_tracker:
            args.append('--disable-tracker')
        try:
            python_cmd.run(install_builder, *args)
        except subprocess.CalledProcessError:
            sys.exit(1)
Пример #2
0
def build():
    process_cmd_line()

    cc = get_cc()

    cc.set_debug(options.enable_debug)

    #if options.enable_profiling:
    #    compile_flags.append('-pg')
    #    link_flags.append('-pg')

    if options.optimise not in range(5):
        print('Unsupported optimisation level: {}'.format(options.optimise),
              file=sys.stderr)
        sys.exit(1)
    cc.set_optimisation(options.optimise)

    builder = PrettyBuilder()

    if options.enable_python_bindings:
        try:
            python_cmd = command.PythonCommand()
        except RuntimeError:
            print(
                'Python bindings were requested but Python 2.7 was not found.',
                file=sys.stderr)
            sys.exit(1)

    if options.enable_tests_mem_debug:
        try:
            output = subprocess.check_output(['valgrind', '--version'],
                                             stderr=subprocess.STDOUT)
        except (OSError, subprocess.CalledProcessError):
            output = b''
        if not output.startswith(b'valgrind'):
            print(
                'Memory debugging of libkunquat tests was requested'
                ' but Valgrind was not found.',
                file=sys.stderr)
            sys.exit(1)

    test_add_external_deps(builder, options, cc)

    test_cc = deepcopy(cc)
    test_add_test_deps(builder, options, test_cc)

    if options.enable_libkunquat:
        build_libkunquat(builder, options, cc)
        if options.enable_tests:
            test_libkunquat(builder, options, test_cc)

    if options.enable_examples:
        build_examples(builder)
Пример #3
0
def build():

    process_cmd_line()

    if options.enable_long_tests:
        python_modules = ['scripts', 'kunquat']
        fabricate.run('pylint', *python_modules)
        fabricate.run('flake8', *python_modules)

    cc = get_cc(options.cc)

    cc.set_debug(options.enable_debug)

    if options.enable_debug_asserts:
        cc.add_define('ENABLE_DEBUG_ASSERTS')

    #if options.enable_profiling:
    #    compile_flags.append('-pg')
    #    link_flags.append('-pg')

    if options.optimise not in range(5):
        print('Unsupported optimisation level: {}'.format(options.optimise),
              file=sys.stderr)
        sys.exit(1)
    cc.set_optimisation(options.optimise)

    builder = PrettyBuilder()

    if options.enable_python_bindings:
        try:
            python_cmd = command.PythonCommand()
        except RuntimeError:
            print(
                'Python bindings were requested but Python 2.7 was not found.',
                file=sys.stderr)
            sys.exit(1)

    if options.enable_tests_mem_debug:
        try:
            output = subprocess.check_output(['valgrind', '--version'],
                                             stderr=subprocess.STDOUT)
        except (OSError, subprocess.CalledProcessError):
            output = b''
        if not output.startswith(b'valgrind'):
            print(
                'Memory debugging of libkunquat tests was requested'
                ' but Valgrind was not found.',
                file=sys.stderr)
            sys.exit(1)

    test_add_external_deps(builder, options, cc)

    test_cc = deepcopy(cc)
    test_add_test_deps(builder, options, test_cc)

    if options.enable_libkunquat:
        build_libkunquat(builder, options, cc)
        if options.enable_tests:
            test_libkunquat(builder, options, test_cc)
            fabricate.run('env', 'LD_LIBRARY_PATH=build/src/lib', 'python3',
                          '-m', 'unittest', 'discover', '-v')

    if options.enable_examples:
        build_examples(builder)