Subversion Repositories Kolibri OS

Rev

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

  1. import shutil
  2.  
  3. def log(s, end = "\n"):
  4.     print(s, end = end, flush = True)
  5.  
  6. def require_tools(names):
  7.     assert(type(names) == list or type(names) == tuple)
  8.     for name in names:
  9.         assert(type(name) == str)
  10.  
  11.     not_found = []
  12.     for name in names:
  13.         if shutil.which(name) is None:
  14.             not_found.append(name)
  15.  
  16.     if len(not_found) != 0:
  17.         log("Sorry, I can't find some tools:")
  18.         for name in not_found:
  19.             print(f"- {name}")
  20.         exit(1)
  21.  
  22.