Exemplo n.º 1
0
def main():
    arg_parser = argparse.ArgumentParser(description=DESCRIPTION)
    arg_parser.add_argument("--plugin-path", default=".",
                            help="plugin directory path")
    arg_parser.add_argument("--debug", action="store_true",
                            help="add some debug informations in "
                            "case of problems")
    arg_parser.add_argument("--show-plugin-path", action="store_true",
                            default=False,
                            help="show the generated plugin path")
    args = arg_parser.parse_args()
    echo_running("- Building plugin...")
    manager = PluginsManager()
    try:
        plugin = manager.make_plugin(args.plugin_path)
        path = plugin.build()
    except Exception as e:
        echo_nok()
        print(e)
        if args.debug:
            print("details of the problem:")
            raise(e)
        else:
            print("note: use --debug option for more details")
    else:
        echo_ok()
        if args.show_plugin_path:
            echo_bold("plugin file is ready at %s" % path)
Exemplo n.º 2
0
def main():
    arg_parser = argparse.ArgumentParser(description=DESCRIPTION)
    arg_parser.add_argument("--plugin-path",
                            default=".",
                            help="plugin directory path")
    arg_parser.add_argument("--ignore-already-installed",
                            action="store_true",
                            help="ignore already installed plugin "
                            "(in dev mode)")
    arg_parser.add_argument("name", help="plugin name")
    args = arg_parser.parse_args()
    manager = PluginsManager()
    echo_running("- Devlinking plugin %s..." % args.name)
    try:
        manager.develop_plugin(args.plugin_path)
    except AlreadyInstalledPlugin:
        if args.ignore_already_installed:
            p = manager.make_plugin(args.plugin_path)
            if p.is_installed and p.is_dev_linked:
                echo_warning("(already installed)")
                sys.exit(0)
        echo_nok()
        echo_bold("ERROR: the plugin is already installed")
        sys.exit(3)
    except Exception as e:
        echo_nok()
        echo_bold(str(e))
        sys.exit(2)
    echo_ok()
    p = manager.get_plugin(args.name)
    p.print_dangerous_state()
Exemplo n.º 3
0
def main():
    arg_parser = argparse.ArgumentParser(description=DESCRIPTION)
    arg_parser.add_argument("PLUGIN_PATH",
                            default=".",
                            help="plugin directory path to check")
    arg_parser.add_argument("--debug",
                            action="store_true",
                            help="add some debug informations in "
                            "case of problems")
    arg_parser.add_argument("--plugins-base-dir",
                            type=str,
                            default=None,
                            help="can be use to set an alternate "
                            "plugins-base-dir, if not set the value of "
                            "MFMODULE_PLUGINS_BASE_DIR env var is used (or a "
                            "hardcoded standard value).")
    args = arg_parser.parse_args()
    echo_running("- Checking plugin...")
    manager = PluginsManager(args.plugins_base_dir)
    try:
        plugin = manager.make_plugin(args.PLUGIN_PATH)
        plugin.load_full()
        if args.debug:
            print(get_nice_dump(plugin._get_debug()))
    except Exception as e:
        echo_nok()
        echo_bold(str(e))
        if args.debug:
            print("details of the problem:")
            raise (e)
        else:
            print("(note: use 'plugins.check --debug /plugin/path' "
                  "for more details)")
            sys.exit(1)
    echo_ok()