diff options
| author | davidovski <david@davidovski.xyz> | 2021-11-21 22:38:31 +0000 | 
|---|---|---|
| committer | davidovski <david@davidovski.xyz> | 2021-11-21 22:38:31 +0000 | 
| commit | c918fe37aef11dc5e1c7cf90535c02d3224c0d9d (patch) | |
| tree | 2fd09f6a972f9ec53327fe16a812f23a09d59345 /src | |
| parent | ce02c1f3549544486a82d71c4510a19fcbbf1f21 (diff) | |
fixed path adding issues
Diffstat (limited to 'src')
| -rw-r--r-- | src/util.py | 2 | ||||
| -rw-r--r-- | src/verbs/install.py | 23 | 
2 files changed, 15 insertions, 10 deletions
| diff --git a/src/util.py b/src/util.py index d911ce8..5ca3310 100644 --- a/src/util.py +++ b/src/util.py @@ -11,7 +11,7 @@ DEFAULT_BAR_COLOR_RESET = colors.BG_BLACK + colors.CYAN  def add_path(*argv):      a = argv[0]      for b in argv[1:]: -        a = a + (b if a[-1] == "/" else f"/{b}") +        a = a + ("" if a[-1] == "/"  else "/") + (b[1:] if b[0] == "/" else b)      return a  def loading_bar(completed, total, text,  diff --git a/src/verbs/install.py b/src/verbs/install.py index 34974a0..6871f2e 100644 --- a/src/verbs/install.py +++ b/src/verbs/install.py @@ -72,7 +72,6 @@ def retrieve_package_info(sources, checksum, package_name, config,      cache_dir=config["dir"]["cache"]      # TODO we may potentially do this a few times while resolving deps, might want to cache things here -    # TODO actually use the ping times we made earlier to decide which source to pick      for source in get_best_source(sources_list=sources_list):          url = sources[source] @@ -98,10 +97,7 @@ def retrieve_package(sources, package_info, package_name, config,      sources_list=config["dir"]["sources"]      cache_dir=config["dir"]["cache"]      keychain_dir=config["dir"]["keychain"] - -    # TODO actually use the ping times we made earlier to decide which source to pick -    # TODO actually save tar file, and add loading bar - +          checksum = package_info["CHECKSUM"]      for source in get_best_source(sources_list=sources_list): @@ -189,7 +185,7 @@ def find_all_dependencies(package_names, options, config):                      deps = resolve_dependencies(info)                      for dep in deps:                          if not dep in all_deps: -                            if is_installed(dep, config): +                            if is_installed(dep, config, options["r"]):                                  print(colors.YELLOW + f"Package {query} has already been installed")                              else:                                  to_check.append(dep) @@ -208,11 +204,20 @@ def find_all_dependencies(package_names, options, config):      all_deps.reverse()      return all_deps -def is_installed(package_name, config): -    # TODO only check that the requested checksum is installed.. if not then its a new update or something -    # TODO actually find out if its installed +def is_installed(package_name, config, root="/"): +    installed_dir = util.add_path(root, config["dir"]["installed"]) +    if os.path.exists(installed_dir): +        files = os.listdir(installed_dir) +        return package_name in files      return False +def install_package(package_path, package_info, config, root="/"): +    # untar and move into root +    # then add entry in the config["dir"]["installed"] + +    pass + +  def install(args, options, config):      sources = config["sources"]      repos = config["repos"] | 
