def link_std_modules(): logging.disable(logging.WARNING) for subdir in os.listdir(global_module_path): module_json = os.path.join(global_module_path, subdir, 'module.json') with open(module_json, 'r') as json_file: data = json.load(json_file) module_name = data['name'] link_args = argparse.Namespace(module_or_path=module_name, config=None, target=get_current_target()) link.execCommand(link_args, None)
def link_std_modules(): root_module_path = os.path.join('/','usr', 'local', 'lib', 'yotta_modules') for subdir in os.listdir(root_module_path): module_json = os.path.join(root_module_path, subdir, 'module.json') with open(module_json, 'r') as json_file: data = json.load(json_file) module_name = data['name'] link_args = argparse.Namespace(module_or_path=module_name, config=None, target=get_current_target()) link.execCommand(link_args, None)
def link_mounted_modules(): # Globally link the dev modules to replace the standard modules cur_dir = os.getcwd() link_file = os.path.join(cur_dir, '.kubos-link.json') link_args = argparse.Namespace(module_or_path=None, config=None, target=None) if os.path.isfile(link_file): with open(link_file, 'r') as dev_links: link_data = json.load(dev_links) for key in link_data: module_path = link_data[key] os.chdir(module_path) link.execCommand(link_args, None) os.chdir(cur_dir)
def execCommand(args, following_args): ''' Defining a specific `kubos link` command allows the CLI to "bulk" link all of the global targets and modules into a project in one step. This is useful for instances where either new kubos modules are added after a Kubos update, or for projects that were cloned from github rather than created with the CLI `init` command. If the -a or --all argument is not provided this command proxies to the default yotta command implementation. ''' arg_dict = vars(args) if arg_dict['all']: link_global_cache_to_project(os.getcwd()) proj_type = get_project_type() if proj_type == 'rt': remove_unruly_rt_dependencies() else: #pass in the args argparse.Namespace object - not the dictionary from above link.execCommand(args, following_args)
def _link(): link_args = argparse.Namespace(module_or_path=None, config=None, target=None) link.execCommand(link_args, None)