Ejemplo n.º 1
0
 def __delete_deprecated_files(self):
     for hash in self.__promoted_info.deprecated_files():
         full_path = util.path_join(self.__main_dir, self.__local_files[hash])
         try:
             os.remove(full_path)
         except FileNotFoundError:
             pass
Ejemplo n.º 2
0
 def __read_current_version(self):
     try:
         p = util.path_join(self.__main_dir, ".version")
         with open(p, 'r') as f:
             self.__version = f.readline().strip()
     except:
         self.__version = 0
Ejemplo n.º 3
0
 def __move_finale_place(self):
     for dirs, files in util.walk(self.__next_dir):
         for file in files:
             rel_file = file.split(self.__next_dir + "/", 2)[1]
             dst = util.path_join(self.__main_dir, rel_file)
             directory = util.dir_name(dst)
             if not util.exists(directory):
                 os.mkdir(directory)
             os.rename(file, dst)
Ejemplo n.º 4
0
 def __load_hashes(self):
     try:
         p = util.path_join(self.__main_dir, ".files")
         with open(p, 'r') as f:
             for line in f:
                 hash, path = line.split(' ', 1)
                 self.__local_files[hash] = path.strip()
     except Exception as e:
         self.__local_files = {}
Ejemplo n.º 5
0
 def __download_changed_files(self):
     for hash, path in self.__promoted_info.changed_files().items():
         dst = util.path_join(self.__next_dir, path)
         self.__create_tmp_dir_for_file(dst)
         self.__download_by_hash(hash, dst)
Ejemplo n.º 6
0
 def __write_out_version_file(self):
     version_file = util.path_join(self.__next_dir, ".version")
     f = open(version_file, "w")
     f.write(self.__promoted_info.version)
     f.close()
Ejemplo n.º 7
0
 def __save_hashes_of_files(self):
     p = util.path_join(self.__next_dir, ".files")
     out = open(p, "a")
     for h, f in self.__promoted_info.promoted_files.items():
         out.write(h + " " + f + '\n')
     out.close()