How to use the pybuilder.core.depends function in pybuilder

To help you get started, we’ve selected a few pybuilder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deepmipt / kpi2017 / build.py View on Github external
@depends("archive_model")
def upload_model_to_nexus(project):
    """
    Use 'pyb -P model_name="" upload_model_to_nexus' to upload archived model to Nexus repository
    of the lab. If model_name == 'deeppavlov_docs', then documentation from build/docs will be archived and uploaded.
    archive_model task will be executed before.
    """
    import requests, datetime
    os.chdir('build')
    model_name = project.get_property('model_name')
    file_name = model_name + '_' + datetime.date.today().strftime("%y%m%d") + '.tar.gz'
    url = 'http://share.ipavlov.mipt.ru:8080/repository/'
    url += 'docs/' if model_name == 'deeppavlov_docs' else 'models/'
    headers = {'Content-Type': 'application/binary'}
    with open(file_name, 'rb') as artifact:
        requests.put(url + model_name + '/' + file_name, headers=headers,
                     data=artifact, auth=('jenkins', 'jenkins123'))
github pybuilder / pybuilder / src / main / python / pybuilder / plugins / python / sphinx_plugin.py View on Github external
@depends("prepare")
def sphinx_quickstart_generate(project, logger):
    """Runs sphinx-build against rst sources for the given project.
    """
    build_command = get_sphinx_quickstart_command(project)
    run_sphinx_build(build_command, "sphinx-quickstart", logger, project)
github pybuilder / pybuilder / src / main / python / pybuilder / plugins / python / cram_plugin.py View on Github external
@depends("prepare")
@description("Run Cram command line tests")
def run_cram_tests(project, logger):
    logger.info("Running Cram command line tests")

    cram_tests = list(_find_files(project))
    if not cram_tests or len(cram_tests) == 0:
        if project.get_property("cram_fail_if_no_tests"):
            raise BuildFailedException("No Cram tests found!")
        else:
            return

    command_and_arguments = _cram_command_for(project)
    command_and_arguments.extend(cram_tests)
    report_file = _report_file(project)

    env = os.environ.copy()
github pybuilder / pybuilder / src / main / python / pybuilder / plugins / python / sonarqube_plugin.py View on Github external
@depends("analyze")
def run_sonar_analysis(project, logger):

    sonar_scanner = build_sonar_scanner(project)

    result = sonar_scanner.run(project.expand_path("$dir_reports/sonar-scanner"))

    if result.exit_code != 0:
        logger.error(
            "sonar-scanner exited with code {exit_code}. See {reports_dir} for more information.".format(
                exit_code=result.exit_code,
                reports_dir=project.expand_path("$dir_reports")))

        if project.get_property("verbose"):
            logger.error("Contents of {0}:".format(result.error_report_file))
            logger.error("\n".join(result.error_report_lines))
github pybuilder / pybuilder / src / main / python / pybuilder / plugins / core_plugin.py View on Github external
@depends(package, optional(verify))
@description("Publishes the project.")
def publish():
    pass
github pybuilder / pybuilder / src / main / python / pybuilder / plugins / core_plugin.py View on Github external
@depends(compile_sources, optional(run_unit_tests))
@description("Packages the application.")
def package():
    pass
github pybuilder / pybuilder / src / main / python / pybuilder / plugins / python / sphinx_plugin.py View on Github external
@depends("prepare")
def sphinx_pyb_quickstart_generate(project, logger):
    """Generates PyB-specific quickstart

    Actually sticks the PyB-specific paths and generated stub into the configuration.
    """
    sphinx_quickstart_generate(project, logger)  # If this fails we won't touch the config directory further

    sphinx_config_path = project.get_property("sphinx_config_path")
    sphinx_pyb_config_path = project.expand_path(*SPHINX_PYB_CONFIG_FILE_PATH)
    sphinx_pyb_config_dir = dirname(sphinx_pyb_config_path)
    sphinx_pyb_rel_dir = relpath(sphinx_pyb_config_dir, sphinx_config_path)

    content = """\
# Automatically generated by PyB
import sys
from os import path
github pybuilder / pybuilder / src / main / python / pybuilder / plugins / python / frosted_plugin.py View on Github external
@depends("prepare")
def analyze(project, logger):
    """ Applies the frosted script to the sources of the given project. """
    logger.info("Executing frosted on project sources.")

    verbose = project.get_property("verbose")
    project.set_property_if_unset("frosted_verbose_output", verbose)

    command = ExternalCommandBuilder("frosted", project)
    for ignored_error_code in project.get_property("frosted_ignore", []):
        command.use_argument("--ignore={0}".format(ignored_error_code))

    include_test_sources = project.get_property("frosted_include_test_sources")
    include_scripts = project.get_property("frosted_include_scripts")

    result = command.run_on_production_source_files(logger,
                                                    include_test_sources=include_test_sources,
github pybuilder / pybuilder / src / main / python / pybuilder / plugins / python / sphinx_plugin.py View on Github external
@depends("prepare")
def sphinx_generate(project, logger):
    """Runs sphinx-build against rst sources for the given project.
    """
    sphinx_pyb_dir = project.expand_path(*SPHINX_PYB_RUNTIME_DIR)
    if exists(sphinx_pyb_dir):
        logger.debug("Removing %s", sphinx_pyb_dir)
        rmtree(sphinx_pyb_dir)
    logger.debug("Creating %s", sphinx_pyb_dir)
    mkdir(sphinx_pyb_dir)

    generate_sphinx_pyb_runtime_config(project, logger)

    generate_sphinx_apidocs(project, logger)

    builders = as_list(project.get_property("sphinx_doc_builder"))
    for builder in builders: