def assert_cram_is_executable(logger): """ Asserts that the cram script is executable. """ logger.debug("Checking if cram is executable.") assert_can_execute(command_and_arguments=["cram", "--version"], prerequisite="cram", caller="plugin python.cram")
def assert_dpkg_is_available(logger): """Asserts that the dpkg-buildpackage is available. """ logger.debug("Checking if dpkg-buildpackage is available") assert_can_execute( ["dpkg-buildpackage", "--help"], "dpkg-buildpackage", "plugin python.stdeb")
def assert_sphinx_quickstart_is_available(logger): """Asserts that the sphinx-quickstart script is available. """ logger.debug("Checking if sphinx-quickstart is available.") assert_can_execute( ["sphinx-quickstart", "--version"], "sphinx", "plugin python.sphinx")
def assert_py2dsc_deb_is_available(logger): """Asserts that the py2dsc-deb is available. """ logger.debug("Checking if py2dsc-deb is available.") assert_can_execute( ["py2dsc-deb", "-h"], "py2dsc-deb", "plugin python.stdeb")
def set_description(project, logger): if project.get_property("distutils_readme_description"): try: assert_can_execute(["pandoc", "--version"], "pandoc", "distutils") doc_convert(project, logger) except (MissingPrerequisiteException, ImportError): logger.warn("Was unable to find pandoc or pypandoc and did not convert the documentation")
def assert_flake8_is_executable(logger): """ Asserts that the flake8 script is executable. """ logger.debug("Checking if flake8 is executable.") assert_can_execute(command_and_arguments=["flake8", "--version"], prerequisite="flake8", caller="plugin python.flake8")
def assert_frosted_is_executable(logger): """ Asserts that the frosted script is executable. """ logger.debug("Checking if frosted is executable.") assert_can_execute( command_and_arguments=["frosted", "--version"], prerequisite="frosted (PyPI)", caller="plugin python.frosted" )
def assert_gzip_is_executable(logger): """ Asserts that the gzip program is executable. """ logger.debug("Checking if gzip is executable.") assert_can_execute(command_and_arguments=["gzip", "--version"], prerequisite="gzip", caller="plugin ronn_manpage_plugin")
def assert_ronn_is_executable(logger): """ Asserts that the ronn script is executable. """ logger.debug("Checking if ronn is executable.") assert_can_execute(command_and_arguments=["ronn", "--version"], prerequisite="ronn", caller="plugin ronn_manpage_plugin")
def assert_sphinx_is_available(logger): """Asserts that the sphinx-build script is available. """ logger.debug("Checking if sphinx-build and sphinx-apidoc are available.") assert_can_execute( ["sphinx-build", "--version"], "sphinx", "plugin python.sphinx") assert_can_execute( ["sphinx-apidoc", "--version"], "sphinx", "plugin python.sphinx")
def upload_distribution(project, logger) : project.build_depends_on("devpi") assert_can_execute(["devpi", "--version"], prerequisite="devpi PyPi Server", caller="devpi_plugin") index_name = "{}/{}".format(project.get_property("devpi_user"), project.get_property("devpi_staging_index")) logger.info("Uploading binary distribution in %s to staging index %s", project.expand_path("$dir_dist"), index_name) run_devpi_command(project, logger, ["login", project.get_property("devpi_user"), "--password="******"use", project.get_property("devpi_staging_index")]) run_devpi_command(project, logger, ["upload", "--no-vcs", "--formats=bdist_wheel,bdist_egg"])
def generate_manpage_with_pandoc(project, logger): import os import shutil import subprocess assert_can_execute(['pandoc', '-v'], 'pandoc', 'generate_manpage_with_pandoc') subprocess.check_output('pandoc -s -t man man-yadtminion.md -o docs/man/yadtminion.1.man', shell=True) subprocess.check_output('rm -f docs/man/yadtminion.1.man.gz && gzip -9 docs/man/yadtminion.1.man', shell=True) for script in os.listdir('src/main/scripts'): script_manpage = '%s.1.man.gz' % script shutil.copyfile('docs/man/yadtminion.1.man.gz', 'docs/man/%s' % script_manpage)
def pdoc_prepare(project, logger): """ Asserts that pdoc is executable. """ logger.debug("Checking if pdoc is executable.") assert_can_execute(command_and_arguments=["pdoc", "--version"], prerequisite="pdoc", caller="plugin python.pdoc") pdoc_output_dir = project.expand_path("$pdoc_output_dir") if not os.path.exists(pdoc_output_dir): os.mkdir(pdoc_output_dir)
def push_distribution(project, logger) : project.build_depends_on("devpi") assert_can_execute(["devpi", "--version"], prerequisite="devpi PyPi Server", caller="devpi_plugin") distribution_name = "{}-{}".format(project.name, project.version) index_name = "{}/{}".format(project.get_property("devpi_user"), project.get_property("devpi_release_index")) logger.info("Pushing binary distribution %s to release index %s", distribution_name, index_name) run_devpi_command(project, logger, ["login", project.get_property("devpi_user"), "--password="******"use", project.get_property("devpi_release_index")]) run_devpi_command(project, logger, ["push", distribution_name, index_name])
def pdoc_generate(project, logger): assert_can_execute(command_and_arguments=["pdoc", "--version"], prerequisite="pdoc", caller=pdoc_generate.__name__) logger.info("Generating pdoc documentation") command_and_arguments = ["pdoc", "--html", "pybuilder", "--all-submodules", "--overwrite", "--html-dir", "api-doc"] source_directory = project.get_property("dir_source_main_python") environment = {"PYTHONPATH": source_directory, "PATH": os.environ["PATH"]} subprocess.check_call(command_and_arguments, shell=False, env=environment)
def check_pep8_available(logger): logger.debug("Checking availability of pep8") assert_can_execute(("pep8", ), "pep8", "plugin python.pep8")
def check_pylint_availability(logger): logger.debug("Checking availability of pylint") assert_can_execute(("pylint", ), "pylint", "plugin python.pylint") logger.debug("pylint has been found")
def check_pymetrics_available(logger): logger.debug("Checking availability of pymetrics") assert_can_execute(("pymetrics", "--nosql", "--nocsv"), "pymetrics", "plugin python.pymetrics") logger.debug("pymetrics has been found")
def check_pychecker_available(logger): logger.debug("Checking availability of pychecker") assert_can_execute(("pychecker", ), "pychecker", "plugin python.pychecker")
def check_sonar_scanner_availability(): assert_can_execute( ("sonar-scanner", "-h"), "sonar-scanner", "plugin python.sonarqube")
def check_graphviz_available(logger): logger.debug("Checking availability of graphviz") assert_can_execute(("dot", "-V"), "graphviz", "plugin python.snakefood") logger.debug("graphviz has been found")
def check_sonar_scanner_availability(): assert_can_execute(("sonar-scanner", "-h"), "sonar-scanner", "plugin python.sonarqube")
def check_pip_available(logger): logger.debug("Checking if pip is available") assert_can_execute("pip", "pip", "plugin python.install_dependencies")
def check_pylint_availability(logger): logger.debug("Checking availability of pychecker") assert_can_execute(("pylint", ), "pylint", "plugin python.pylint") logger.debug("pylint has been found")
def check_snakefood_available(logger): logger.debug("Checking availability of snakefood") assert_can_execute(("sfood", "-h"), "sfood", "plugin python.snakefood") logger.debug("snakefood has been found")
def generate_manpage_with_pandoc(project, logger): assert_can_execute(["pandoc", "-v"], "pandoc", "generate_manpage_with_pandoc") import subprocess subprocess.check_output("pandoc -s -t man man-yadtshell.md -o docs/man/yadtshell.1.man", shell=True) subprocess.check_output("rm -f docs/man/yadtshell.1.man.gz && gzip -9 docs/man/yadtshell.1.man", shell=True)
def generate_manpage_with_pandoc(project, logger): assert_can_execute(['pandoc', '-v'], 'pandoc', 'generate_manpage_with_pandoc') import subprocess subprocess.check_output('pandoc -s -t man man-yadtshell.md -o docs/man/yadtshell.1.man', shell=True) subprocess.check_output('rm -f docs/man/yadtshell.1.man.gz && gzip -9 docs/man/yadtshell.1.man', shell=True)