def install(self, package_names): dftlib.ensure_dir(self.workdir) pkgs_avail = self._pkgs_get_available() for package_name in package_names: if package_name in pkgs_avail: pkg = package(package_name) if pkg.status() == "installed": pass """
def _pkgs_update_available(self): """ If avilable packages.json doesn't exist, download it. If it does exist download a fresh copy, and if the versions differ, write the contents of the new file to the old one. """ dftlib.ensure_dir(self.workdir) pkgs_web = dftlib.get_url(self.config["urls"]["pkg_list"]) if not path.exists(path.join(self.workdir, self.pkg_list)): dftlib.write(self.pkg_list, pkgs_web) else: pkgs_new = json.loads(pkgs_web) pkgs_cur = json.loads(dftlib.read( path.join(self.workdir, self.pkg_list))) if int(pkgs_new["version"]) > int(pkgs_cur["version"]): dftlib.write(self.pkg_list, json.dumps(pkgs_new))