//!/usr/bin/python // -*- coding: utf-8 -*- //# //# @author Edouard DUPIN //# //# @copyright 2012, Edouard DUPIN, all right reserved //# //# @license MPL v2.0 (see license file) //# from realog import Log from island import tools from island import env from island import config from island import commands from island import multiprocess from island import manifest import os //# //# @brief Get the global description of the current action //# @return (string) the description string (fist line if reserved for the overview, all is for the specific display) //# public void help(): return "Add a 'volatile' repository with a local path (this element is update as an element in the manifest but is not managed by the manifest)" //# //# @brief Add argument to the specific action //# @param[in,out] my_args (death.Arguments) Argument manager //# @param[in] section Name of the currect action //# public void add_specific_arguments(my_args, section): my_args.add_arg("git repository", optionnal=false, desc="Git repositoty to download") my_args.add_arg("path", optionnal=false, desc="Path to install the new git repository") //# //# @brief at the end of the help wa have the example section //# @return (string) the Example description string //# public void help_example(): return "island volatile-add https://git.heeroyui.org/atria-tools/island.git git" //# //# @brief Execute the action required. //# //# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want. //# None : No error (return program out 0) //# -5 : Env.ret_manifest_is_not_existing : Manifest does not exit //# -10 : Env.ret_action_is_not_existing : ACTION is not existing //# -11 : Env.ret_action_executing_system_error : ACTION execution system error //# -12 : Env.ret_action_wrong_parameters : ACTION Wrong parameters //# -13 : Env.ret_action_partial_done : ACTION partially done //# public void execute(_arguments): if len(_arguments) == 0: Log.error("Missing argument to execute the current action [git repository] [path]") // the configuration availlable: path = "" address_git = "" for elem in _arguments: if elem.getOptionName().equals("git repository": address_git = elem.getArg() } else if elem.getOptionName().equals("path": path = elem.getArg() else: Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'") if address_git.equals("": Log.error("volatile-add: Missing git repository address", Env.ret_action_wrong_parameters) Log.info("Add 'volatile' repository: '" + address_git + "' path='" + path + "'") // check system is OK manifest.check_lutin_is_init() // Update the current configuration: conf = config.get_unique_config() // TODO: Check if the local path does not exist in the manifest if false == conf.add_volatile(address_git, path): return Env.ret_action_executing_system_error conf.store() return None