def exit_if_missing_graphviz(self): """ Detect the presence of the dot utility to make a png graph. """ (out, err) = utils.capture_shell("which dot") if "dot" not in out: ui.error(c.MESSAGES["dot_missing"])
def graph_png(self): """ Export a graph of the data in png format using graphviz/dot. """ if not self.out_file: ui.error(c.MESSAGES["png_missing_out"]) sys.exit(1) cli_flags = "-Gsize='{0}' -Gdpi='{1}' {2} ".format( self.size, self.dpi, self.flags) cli_flags += "-o {0}".format(self.out_file) (out, err) = utils.capture_shell( "ansigenome export -t graph -f dot | dot -Tpng {0}".format( cli_flags)) if err: ui.error(err)
def graph_png(self): """ Export a graph of the data in png format using graphviz/dot. """ if not self.out_file: ui.error(c.MESSAGES["png_missing_out"]) sys.exit(1) cli_flags = "-Gsize='{0}' -Gdpi='{1}' {2} ".format(self.size, self.dpi, self.flags) cli_flags += "-o {0}".format(self.out_file) (out, err) = utils.capture_shell( "ansigenome export -t graph -f dot | dot -Tpng {0}" .format(cli_flags)) if err: ui.error(err)
def execute_command(self): """ Execute the shell command. """ stderr = "" role_count = 0 for role in utils.roles_dict(self.roles_path): self.command = self.command.replace("%role_name", role) (_, err) = utils.capture_shell("cd {0} && {1}".format( os.path.join(self.roles_path, role), self.command)) stderr = err role_count += 1 utils.exit_if_no_roles(role_count, self.roles_path) if len(stderr) > 0: ui.error(c.MESSAGES["run_error"], stderr[:-1]) else: if not self.config["options_quiet"]: ui.ok( c.MESSAGES["run_success"].replace("%role_count", str(role_count)), self.options.command)
def execute_command(self): """ Execute the shell command. """ stderr = "" role_count = 0 for role in utils.roles_dict(self.roles_path): self.command = self.command.replace("%role_name", role) (_, err) = utils.capture_shell("cd {0} && {1}". format(os.path.join( self.roles_path, role), self.command)) stderr = err role_count += 1 utils.exit_if_no_roles(role_count, self.roles_path) if len(stderr) > 0: ui.error(c.MESSAGES["run_error"], stderr[:-1]) else: if not self.config["options_quiet"]: ui.ok(c.MESSAGES["run_success"].replace( "%role_count", str(role_count)), self.options.command)
import pkg_resources import os.path import utils GIT_AUTHOR = utils.capture_shell("git config user.name")[0][:-1] GIT_EMAIL = utils.capture_shell("git config user.email")[0][:-1] PACKAGE_RESOURCE = pkg_resources.resource_filename(__name__, "data") VALID_ACTIONS = ("config", "scan", "gendoc", "genmeta", "export", "init", "run") ALLOWED_GENDOC_FORMATS = ("rst", "md") ALLOWED_GRAPH_FORMATS = ("png", "dot") ALLOWED_REQS_FORMATS = ("txt", "yml") ALLOWED_DUMP_FORMATS = ("json") LICENSE_TYPES = [ ["MIT", "https://tldrlegal.com/license/mit-license"], ["GPLv2", "https://tldrlegal.com/license/gnu-general-public-license-v2"], [ "GPLv3", "https://tldrlegal.com/license/" + "gnu-general-public-license-v3-%28gpl-3%29" ], [ "AGPLv3", "https://tldrlegal.com/license/" + "gnu-affero-general-public-license-v3-%28agpl-3.0%29" ], [ "LGPL", "https://tldrlegal.com/license/" +
import pkg_resources import os.path import utils GIT_AUTHOR = utils.capture_shell("git config user.name")[0][:-1] GIT_EMAIL = utils.capture_shell("git config user.email")[0][:-1] PACKAGE_RESOURCE = pkg_resources.resource_filename(__name__, "data") VALID_ACTIONS = ("config", "scan", "gendoc", "genmeta", "export", "init", "run") ALLOWED_GENDOC_FORMATS = ("rst", "md") ALLOWED_GRAPH_FORMATS = ("png", "dot") ALLOWED_REQS_FORMATS = ("txt", "yml") ALLOWED_DUMP_FORMATS = ("json") LICENSE_TYPES = [ ["MIT", "https://tldrlegal.com/license/mit-license"], ["GPLv2", "https://tldrlegal.com/license/gnu-general-public-license-v2"], ["GPLv3", "https://tldrlegal.com/license/" + "gnu-general-public-license-v3-%28gpl-3%29"], ["AGPLv3", "https://tldrlegal.com/license/" + "gnu-affero-general-public-license-v3-%28agpl-3.0%29"], ["LGPL", "https://tldrlegal.com/license/" + "gnu-lesser-general-public-license-v2.1-(lgpl-2.1)"], ["Apache-2.0", "https://tldrlegal.com/license/" + "apache-license-2.0-%28apache-2.0%29"], ["BSDv2", "https://tldrlegal.com/license/bsd-2-clause-license-(freebsd)"],