예제 #1
0
def build_python_examples():
    examples_path = posixpath.join(config.RELEASE_DIR, 'python', 'examples')
    examples_list = os.listdir(examples_path)

    pychecker_path = 'pychecker'

    if platform.system() == "Windows":
        pychecker_path = 'c:/python27/scripts/' + pychecker_path

    pychecker_command = pychecker_path + ' main.py'

    for example_name in examples_list:
        if not os.path.isdir(example_name):
            continue

        example_path = posixpath.join(examples_path, example_name)

        print 'Checking', example_name, 'example:'
        error_code = subprocess.call(pychecker_command,
                                     cwd=example_path,
                                     shell=True)

        if error_code != 0:
            utility.add_log_message(
                'pychecker failed to verify {0} example.'.format(example_name))
예제 #2
0
def build_c_examples():
    examples_path = posixpath.join(config.RELEASE_DIR, 'driver', 'examples')

    examples_list = os.listdir(examples_path)

    for example_name in examples_list:
        example_path = posixpath.join(examples_path, example_name)

        if not os.path.isdir(example_path):
            continue

        # GCC
        gcc_example_path = posixpath.join(example_path, 'gcc')
        error_code = subprocess.call(config.PLATFORM_MAKE,
                                     cwd=gcc_example_path,
                                     shell=True)

        if error_code != 0:
            log_message = 'Failed to compile {0} example with gcc.'.format(
                example_name)
            utility.add_log_message(log_message)

        # MSVC
        if config.PLATFORM_SYSTEM == 'Windows':
            msvc_example_path = posixpath.join(example_path, 'msvc')
            error_code = subprocess.call(
                ['msbuild', '{0}.vcxproj'.format(example_name)],
                cwd=msvc_example_path,
                shell=True)

            if error_code != 0:
                log_message = 'Failed to compile {0} example with msvc.'.format(
                    example_name)
                utility.add_log_message(log_message)
예제 #3
0
def build_c_examples():
    examples_path = posixpath.join(config.RELEASE_DIR, 'driver', 'examples')

    examples_list = os.listdir(examples_path)

    for example_name in examples_list:
        example_path = posixpath.join(examples_path, example_name)

        if not os.path.isdir(example_path):
            continue

        # GCC
        gcc_example_path = posixpath.join(example_path, 'gcc')
        error_code = subprocess.call(config.PLATFORM_MAKE, cwd=gcc_example_path, shell=True)

        if error_code != 0:
            log_message = 'Failed to compile {0} example with gcc.'.format(example_name)
            utility.add_log_message(log_message)

        # MSVC
        if config.PLATFORM_SYSTEM == 'Windows':
            msvc_example_path = posixpath.join(example_path, 'msvc')
            error_code = subprocess.call(['msbuild', '{0}.vcxproj'.format(example_name)],
                                         cwd=msvc_example_path, shell=True)

            if error_code != 0:
                log_message = 'Failed to compile {0} example with msvc.'.format(example_name)
                utility.add_log_message(log_message)
예제 #4
0
def build_examples():
    if not os.path.exists(config.RELEASE_DIR):
        utility.add_log_message('Need a build before we are able to test build examples.')
        return

    build_c_examples()

    #  Python
    bindings.build_python_examples()
예제 #5
0
def build():
    logger.info('Building serialization dll artifacts with CMake')

    sdk_info = Sdk(config.ARTIFACTS_ROOT, config.SDK_VERSION)

    utility.make_directory(config.SERIALIZATION_BUILD_DIR)

    if config.PLATFORM_SYSTEM == 'Windows':
        generator = 'MinGW Makefiles'
    elif config.PLATFORM_SYSTEM in ['Linux', 'Darwin']:
        generator = 'Unix Makefiles'
    else:
        raise SystemError('Unknown platform. Not able to determine generator.')

    cmake_environment = None

    # Remove any git/bin path in environment variable PATH
    if config.PLATFORM_SYSTEM == 'Windows':
        environment_path = os.environ['PATH']
        environment_path_list = environment_path.split(';')
        environment_path_list = [path for path in environment_path_list if 'Git\\bin' not in path]
        environment_path = ';'.join(environment_path_list)

        cmake_environment = copy.copy(os.environ)
        cmake_environment['PATH'] = environment_path

    for artifact in ['driver', 'binding']:
        cmake_args = ['cmake', '-G', '{0}'.format(generator),
                      '-DNRF51_SDK_PATH={0}'.format(sdk_info.path),
                      '-DSERIALIZATION_VERSION={0}'.format(config.VERSION),
                      '-DSERIALIZATION_REVISION={0}'.format(config.REVISION),
                      '-DARTIFACT={0}'.format(artifact),
                      config.REPO_ROOT_DIR]

        logging.debug("Starting to build with command: %s", " ".join(cmake_args))

        return_code = None

        try:
            return_code = subprocess.call(cmake_args,
                                          shell=False,
                                          env=cmake_environment)

            if return_code != 0:
                err_msg = 'Failed to prepare build of {0} libraries. Error code: {1}.'.format(artifact, return_code)
                utility.add_log_message(err_msg)
                raise SystemError(err_msg)

            return_code = subprocess.call([config.PLATFORM_MAKE], shell=True)

            if return_code != 0:
                err_msg = 'Failed to build artifact {0}. Error code: {0}.'.format(artifact, return_code)
                utility.add_log_message(err_msg)
                raise SystemError(err_msg)
        except Exception, e:
            logger.fatal(e)
            return return_code
예제 #6
0
def build_examples():
    if not os.path.exists(config.RELEASE_DIR):
        utility.add_log_message(
            'Need a build before we are able to test build examples.')
        return

    build_c_examples()

    #  Python
    bindings.build_python_examples()
예제 #7
0
def build_python_examples():
    examples_path = posixpath.join(config.RELEASE_DIR, 'python',
                                   'examples')
    examples_list = os.listdir(examples_path)

    pychecker_path = 'pychecker'

    if platform.system() == "Windows":
        pychecker_path = 'c:/python27/scripts/' + pychecker_path

    pychecker_command = pychecker_path + ' main.py'

    for example_name in examples_list:
        if not os.path.isdir(example_name):
            continue

        example_path = posixpath.join(examples_path, example_name)

        print 'Checking', example_name, 'example:'
        error_code = subprocess.call(pychecker_command, cwd=example_path, shell=True)

        if error_code != 0:
            utility.add_log_message('pychecker failed to verify {0} example.'.format(example_name))
예제 #8
0
def build():
    logger.info('Building serialization dll artifacts with CMake')

    sdk_info = Sdk(config.ARTIFACTS_ROOT, config.SDK_VERSION)

    utility.make_directory(config.SERIALIZATION_BUILD_DIR)

    if config.PLATFORM_SYSTEM == 'Windows':
        generator = 'MinGW Makefiles'
    elif config.PLATFORM_SYSTEM in ['Linux', 'Darwin']:
        generator = 'Unix Makefiles'
    else:
        raise SystemError('Unknown platform. Not able to determine generator.')

    cmake_environment = None

    # Remove any git/bin path in environment variable PATH
    if config.PLATFORM_SYSTEM == 'Windows':
        environment_path = os.environ['PATH']
        environment_path_list = environment_path.split(';')
        environment_path_list = [
            path for path in environment_path_list if 'Git\\bin' not in path
        ]
        environment_path = ';'.join(environment_path_list)

        cmake_environment = copy.copy(os.environ)
        cmake_environment['PATH'] = environment_path

    for artifact in ['driver', 'binding']:
        cmake_args = [
            'cmake', '-G', '{0}'.format(generator),
            '-DNRF51_SDK_PATH={0}'.format(sdk_info.path),
            '-DSERIALIZATION_VERSION={0}'.format(config.VERSION),
            '-DSERIALIZATION_REVISION={0}'.format(config.REVISION),
            '-DARTIFACT={0}'.format(artifact), config.REPO_ROOT_DIR
        ]

        logging.debug("Starting to build with command: %s",
                      " ".join(cmake_args))

        return_code = None

        try:
            return_code = subprocess.call(cmake_args,
                                          shell=False,
                                          env=cmake_environment)

            if return_code != 0:
                err_msg = 'Failed to prepare build of {0} libraries. Error code: {1}.'.format(
                    artifact, return_code)
                utility.add_log_message(err_msg)
                raise SystemError(err_msg)

            return_code = subprocess.call([config.PLATFORM_MAKE], shell=True)

            if return_code != 0:
                err_msg = 'Failed to build artifact {0}. Error code: {0}.'.format(
                    artifact, return_code)
                utility.add_log_message(err_msg)
                raise SystemError(err_msg)
        except Exception, e:
            logger.fatal(e)
            return return_code