def download(self): locations = self._get_download_locations() base_dir = self.appdir for location_info in locations: uri_tuple = location_info["uri"] branch_tuple = location_info.get("branch") subdir = location_info.get("subdir") target_loc = None if subdir: target_loc = sh.joinpths(base_dir, subdir) else: target_loc = base_dir branch = None if branch_tuple: (cfg_section, cfg_key) = branch_tuple branch = self.cfg.get(cfg_section, cfg_key) (cfg_section, cfg_key) = uri_tuple uri = self.cfg.get(cfg_section, cfg_key) self.tracewriter.downloaded(target_loc, uri) dirs_made = down.download(target_loc, uri, branch) #ensure this is always added so that #if a keep old happens then this of course #won't be recreated, but if u uninstall without keeping old #then this won't be deleted this time around #adding it in is harmless and willl make sure its removed dirs_made.append(target_loc) self.tracewriter.dir_made(*dirs_made) return len(locations)
def download(self): locations = self._get_download_locations() base_dir = self.appdir am_downloaded = 0 for location_info in locations: uri = location_info.get("uri") if not uri: continue branch = location_info.get("branch") subdir = location_info.get("subdir") target_loc = None if subdir and len(subdir): target_loc = sh.joinpths(base_dir, subdir) else: target_loc = base_dir dirsmade = down.download(target_loc, uri, branch) self.tracewriter.downloaded(target_loc, uri) self.tracewriter.dir_made(*dirsmade) am_downloaded += 1 return am_downloaded
def download(self): locations = self._get_download_locations() base_dir = self.appdir for location_info in locations: uri_tuple = location_info.get("uri") branch_tuple = location_info.get("branch") subdir = location_info.get("subdir") target_loc = None if subdir and len(subdir): target_loc = sh.joinpths(base_dir, subdir) else: target_loc = base_dir branch = None if branch_tuple: branch = self.cfg.get(branch_tuple[0], branch_tuple[1]) uri = self.cfg.get(uri_tuple[0], uri_tuple[1]) self.tracewriter.downloaded(target_loc, uri) self.tracewriter.dir_made(*down.download(target_loc, uri, branch)) self.tracewriter.downloaded(target_loc, uri) return len(locations)