Exemplo n.º 1
0
def createRepository(location, options):
    print 'Creating module %s' % location
    target_path = paths.pathToRepository(location)
    if options.create_dirs and not _checkTargetPaths(target_path, options):
        return 1
    print '  Target path is: %s' % target_path
    print ''
    if options.create_dirs:
        # Create directories.
        createDirectory(target_path, options.dry_run)
        createDirectory(os.path.join(target_path, 'apps'), options.dry_run)
        createDirectory(os.path.join(target_path, 'demos'), options.dry_run)
        createDirectory(os.path.join(target_path, 'include'), options.dry_run)
        createDirectory(os.path.join(target_path, 'include', 'seqan'),
                        options.dry_run)
        createDirectory(os.path.join(target_path, 'tests'), options.dry_run)
    if options.create_cmakelists:
        # Copy over file ${REPOSITORY}/CMakeLists.txt.
        target_file = os.path.join(target_path, 'CMakeLists.txt')
        source_file = paths.pathToTemplate('repository_template',
                                           'CMakeLists.txt')
        replacements = buildReplacements('repository', location, target_path,
                                         target_file, options)
        configureFile(target_file, source_file, replacements, options.dry_run,
                      options)
        # Copy over file ${REPOSITORY}/apps/CMakeLists.txt.
        target_file = os.path.join(target_path, 'apps', 'CMakeLists.txt')
        source_file = paths.pathToTemplate('repository_template',
                                           'apps_CMakeLists.txt')
        replacements = buildReplacements('repository', location, target_path,
                                         target_file, options)
        configureFile(target_file, source_file, replacements, options.dry_run,
                      options)
        # Copy over file ${REPOSITORY}/tests/CMakeLists.txt.
        target_file = os.path.join(target_path, 'tests', 'CMakeLists.txt')
        source_file = paths.pathToTemplate('repository_template',
                                           'tests_CMakeLists.txt')
        replacements = buildReplacements('repository', location, target_path,
                                         target_file, options)
        configureFile(target_file, source_file, replacements, options.dry_run,
                      options)
        # Copy over file ${REPOSITORY}/demos/CMakeLists.txt.
        target_file = os.path.join(target_path, 'demos', 'CMakeLists.txt')
        source_file = paths.pathToTemplate('repository_template',
                                           'demos_CMakeLists.txt')
        replacements = buildReplacements('repository', location, target_path,
                                         target_file, options)
        configureFile(target_file, source_file, replacements, options.dry_run,
                      options)
    return 0
Exemplo n.º 2
0
def createAppTests(location, options):
    print 'Creating app tests at %s' % location
    tests_location = os.path.join(location, 'tests')
    target_path = paths.pathToRepository(tests_location)
    if options.create_dirs and not _checkTargetPaths(target_path, options):
        return 1
    print '  Target path is: %s' % target_path
    print ''

    # Create directories.
    if options.create_dirs:
        createDirectory(target_path, options.dry_run)

    # Copy over file ${APP}/tests/generate_outputs.sh
    target_file = os.path.join(target_path, 'generate_outputs.sh')
    source_file = paths.pathToTemplate('app_tests_template',
                                       'generate_outputs.sh')
    replacements = buildReplacements('app_tests', location, target_path,
                                     target_file, options)
    configureFile(target_file, source_file, replacements, options.dry_run,
                  options)
    # Copy over file ${APP}/tests/run_tests.py
    target_file = os.path.join(target_path, 'run_tests.py')
    source_file = paths.pathToTemplate('app_tests_template', 'run_tests.py')
    replacements = buildReplacements('app_tests', location, target_path,
                                     target_file, options)
    configureFile(target_file, source_file, replacements, options.dry_run,
                  options)

    print '=' * 80
    print 'Do not forget to add the tests in %s:' % os.path.join(
        location, 'CMakeLists.txt')
    print ''
    print '# Add app tests if Python interpreter could be found.'
    print 'if(PYTHONINTERP_FOUND)'
    print '  add_test(NAME app_test_%s COMMAND ${PYTHON_EXECUTABLE}' % os.path.split(
        location)[-1]
    print '    ${CMAKE_CURRENT_SOURCE_DIR}/tests/run_tests.py ${CMAKE_SOURCE_DIR}'
    print '    ${CMAKE_BINARY_DIR})'
    print 'endif(PYTHONINTERP_FOUND)'
    print '=' * 80

    return 0
Exemplo n.º 3
0
def createRepository(location, options):
    print 'Creating module %s' % location
    target_path = paths.pathToRepository(location)
    if options.create_dirs and not _checkTargetPaths(target_path, options):
        return 1
    print '  Target path is: %s' % target_path
    print ''
    if options.create_dirs:
        # Create directories.
        createDirectory(target_path, options.dry_run)
        createDirectory(os.path.join(target_path, 'apps'), options.dry_run)
        createDirectory(os.path.join(target_path, 'demos'), options.dry_run)
        createDirectory(os.path.join(target_path, 'include'), options.dry_run)
        createDirectory(os.path.join(target_path, 'include', 'seqan'), options.dry_run)
        createDirectory(os.path.join(target_path, 'tests'), options.dry_run)
    if options.create_cmakelists:
        # Copy over file ${REPOSITORY}/CMakeLists.txt.
        target_file = os.path.join(target_path, 'CMakeLists.txt')
        source_file = paths.pathToTemplate('repository_template', 'CMakeLists.txt')
        replacements = buildReplacements('repository', location, target_path, target_file, options)
        configureFile(target_file, source_file, replacements, options.dry_run, options)
        # Copy over file ${REPOSITORY}/apps/CMakeLists.txt.
        target_file = os.path.join(target_path, 'apps', 'CMakeLists.txt')
        source_file = paths.pathToTemplate('repository_template', 'apps_CMakeLists.txt')
        replacements = buildReplacements('repository', location, target_path, target_file, options)
        configureFile(target_file, source_file, replacements, options.dry_run, options)
        # Copy over file ${REPOSITORY}/tests/CMakeLists.txt.
        target_file = os.path.join(target_path, 'tests', 'CMakeLists.txt')
        source_file = paths.pathToTemplate('repository_template', 'tests_CMakeLists.txt')
        replacements = buildReplacements('repository', location, target_path, target_file, options)
        configureFile(target_file, source_file, replacements, options.dry_run, options)
        # Copy over file ${REPOSITORY}/demos/CMakeLists.txt.
        target_file = os.path.join(target_path, 'demos', 'CMakeLists.txt')
        source_file = paths.pathToTemplate('repository_template', 'demos_CMakeLists.txt')
        replacements = buildReplacements('repository', location, target_path, target_file, options)
        configureFile(target_file, source_file, replacements, options.dry_run, options)
    return 0
Exemplo n.º 4
0
def createAppTests(location, options):
    print 'Creating app tests at %s' % location
    tests_location = os.path.join(location, 'tests')
    target_path = paths.pathToRepository(tests_location)
    if options.create_dirs and not _checkTargetPaths(target_path, options):
        return 1
    print '  Target path is: %s' % target_path
    print ''

    # Create directories.
    if options.create_dirs:
        createDirectory(target_path, options.dry_run)

    # Copy over file ${APP}/tests/generate_outputs.sh
    target_file = os.path.join(target_path, 'generate_outputs.sh')
    source_file = paths.pathToTemplate('app_tests_template', 'generate_outputs.sh')
    replacements = buildReplacements('app_tests', location, target_path, target_file, options)
    configureFile(target_file, source_file, replacements, options.dry_run, options)
    # Copy over file ${APP}/tests/run_tests.py
    target_file = os.path.join(target_path, 'run_tests.py')
    source_file = paths.pathToTemplate('app_tests_template', 'run_tests.py')
    replacements = buildReplacements('app_tests', location, target_path, target_file, options)
    configureFile(target_file, source_file, replacements, options.dry_run, options)

    print '=' * 80
    print 'Do not forget to add the tests in %s:' % os.path.join(location, 'CMakeLists.txt')
    print ''
    print '# Add app tests if Python interpreter could be found.'
    print 'if(PYTHONINTERP_FOUND)'
    print '  add_test(NAME app_test_%s COMMAND ${PYTHON_EXECUTABLE}' % os.path.split(location)[-1]
    print '    ${CMAKE_CURRENT_SOURCE_DIR}/tests/run_tests.py ${CMAKE_SOURCE_DIR}'
    print '    ${CMAKE_BINARY_DIR})'
    print 'endif(PYTHONINTERP_FOUND)'
    print '=' * 80
    
    return 0