Subversion Repositories Kolibri OS

Rev

Rev 9389 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. import os
  2. import shutil
  3.  
  4. from .network import download
  5. from .constants import tools_cache
  6.  
  7. def builds_get(path, output_path = None):
  8.     url = f"http://builds.kolibrios.org/{path}"
  9.     cached_path = f"{tools_cache}/builds.kolibrios.org/{path}"
  10.     os.makedirs(os.path.dirname(cached_path), exist_ok = True)
  11.     download(url, cached_path, skip_exist = True)
  12.     if output_path != None:
  13.         shutil.copyfile(cached_path, output_path)
  14.         return output_path
  15.     return cached_path
  16.  
  17. def builds_get_contents(path):
  18.     output_path = builds_get(path)
  19.     with open(output_path, "rb") as f:
  20.         return f.read()
  21.  
  22.