def get_pkg(path=""): names = sys.argv[2].split(":") if len(sys.argv) > 3: path = sys.argv[3] for n in names: if r4w.is_meta_pkg(n): res = r4w.get_pkg_list(n) if res: r4w.get_pkgs(list(res.keys()), path) else: r4w.download_package_file(n, path)
def upgrade(): drv = getArgCwd(2) lst = package_list(drv) lst_pkg = r4w.load_pkg_hash(getRptDir() + "\\__pkg__\\pkgs.yaml") res = [] for x in lst: if lst_pkg[x] != lst[x]: res.append(x.split(',')[0]) if len(res) == 0: print("No upgradable package") return print("[%s]" % ",".join(res)) print(" %d packages, update ? (Y/n) " % len(res), end="") str = input().strip() if str == "n": print("...Canceled") else: print("Start upgrade packages") files = [] path = getRptDir() + "\\ros_pkg" for name in res: f = r4w.download_package_file(name, path) files.append(f) for name in res: print("remove package", name) r4w.remove_pkg_file_all(name, drv) for f in files: fname = path + "\\" + f print("Update file", fname) r4w.install_package(fname, drv, False, True)
def download_all(path=None): if path is None: path = getRptDir() + "\\ros_pkg" name = sys.argv[2] if len(sys.argv) > 3: path = sys.argv[3] pkgs, info = r4w.get_depends(name) files = [] count = 1 n = len(pkgs) for x in pkgs: try: fname = r4w.download_package_file(x, path) #fname=r4w.pkgname_to_file(x) files.append(fname) v = r4w.getMonDots(count) y = int(count / n * 100) print("Download: %s [%d]%%\r" % (v, y), end="", flush=True) except: print("ERROR: [", x, "] ", flush=True) pass count += 1 return files
def download(name="", path=None): if path is None: path = getRptDir() + "\\ros_pkg" if not name: name = sys.argv[2] if len(sys.argv) > 3: path = sys.argv[3] return r4w.download_package_file(name, path)
def update_cache(pkg_dir=None): if pkg_dir is None: pkg_dir = getRptDir() + "\\__pkg__" r4w.download_package_file("list", pkg_dir)