Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@after("spam")
def action():
pass
@after("prepare")
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")
@after("prepare")
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")
@after("prepare")
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")
@after("package")
def write_setup_script(project, logger):
setup_script = project.expand_path("$dir_dist", "setup.py")
logger.info("Writing setup.py as %s", setup_script)
with open(setup_script, "w") as setup_file:
setup_file.write(render_setup_script(project))
os.chmod(setup_script, 0o755)
@after("prepare")
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")
@after("prepare")
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")
@after("prepare")
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")
@after("prepare")
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")
@after("prepare")
def assert_pip_api_is_available(logger):
try:
import pip
logger.debug("pip API version {0}".format(pip.__version__))
except (ImportError, AttributeError):
raise MissingPrerequisiteException("pip", "update_plugin")