Пример #1
0
def print_diff(comp, args, output):
    columns, lines = get_terminal_size(fallback=(80,20))
    horiz_line = u'\u2500'*columns
    
    root_dir = MepoState.get_root_dir()
    full_local_path = os.path.join(root_dir,comp.local)
    print("{} (location: {}):".format(comp.name,_get_relative_path(full_local_path)))
    print()
    for line in output.split('\n'):
        #print('   |', line.rstrip())
        print(line.rstrip())
    print(horiz_line)
Пример #2
0
    def __init__(self, remote_url, local_path):
        self.__local = local_path

        if remote_url.startswith('..'):
            rel_remote = os.path.basename(remote_url)
            fixture_url = get_current_remote_url()
            self.__remote = urljoin(fixture_url, rel_remote)
        else:
            self.__remote = remote_url

        root_dir = MepoState.get_root_dir()
        full_local_path = os.path.join(root_dir, local_path)
        self.__full_local_path = full_local_path
        self.__git = 'git -C "{}"'.format(self.__full_local_path)
Пример #3
0
def run(args):
    allcomps = MepoState.read_state()
    for comp in allcomps:
        _update_comp(comp)

    MepoState.write_state(allcomps)

    complist = dict()
    relpath_start = MepoState.get_root_dir()
    for comp in allcomps:
        complist.update(comp.to_dict(relpath_start))
    config_file_root_dir = os.path.join(relpath_start, args.config_file)
    ConfigFile(config_file_root_dir).write_yaml(complist)
    print(f"Components written to '{config_file_root_dir}'")
Пример #4
0
def run(args):
    root_dir = MepoState.get_root_dir()
    allcomps = MepoState.read_state()
    if args.comp_name:  # single comp name is specified, print relpath
        if args.comp_name == "_root":
            # _root is a "hidden" allowed argument for whereis to return
            # the root dir of the project. Mainly used by mepo-cd
            print(root_dir)
        else:
            verify.valid_components([args.comp_name], allcomps)
            for comp in allcomps:
                if comp.name == args.comp_name:
                    full_local_path = os.path.join(root_dir, comp.local)
                    print(_get_relative_path(full_local_path))
    else:  # print relpaths of all comps
        max_namelen = len(max([x.name for x in allcomps], key=len))
        FMT = '{:<%s.%ss} | {:<s}' % (max_namelen, max_namelen)
        for comp in allcomps:
            full_local_path = os.path.join(root_dir, comp.local)
            print(FMT.format(comp.name, _get_relative_path(full_local_path)))