TROUBLESHOOTER.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # This file is used to check for python dependencies and install them to the user
  2. # It's written by: (C) J.Y.Amihud ( and contributers ) 2022 and is under the GNU
  3. # General Public License version 3 or any later version as published by the Free
  4. # Software Foundation.
  5. import os
  6. import json
  7. clr = {
  8. "norm":"\033[00m", # Reset to normal
  9. "bold":"\033[01m", # Bold Text
  10. "ital":"\033[03m", # Italic Text
  11. "undr":"\033[04m", # Underlined
  12. "blnk":"\033[05m", # Blinking
  13. # Text
  14. "tdbl":"\033[30m", # Dark Black
  15. "tdrd":"\033[31m", # Dark Red
  16. "tdgr":"\033[32m", # Dark Green
  17. "tdyl":"\033[33m", # Dark Yellow
  18. "tdbu":"\033[34m", # Dark Blue
  19. "tdma":"\033[35m", # Dark Magenta
  20. "tdcy":"\033[36m", # Dark Cyan
  21. "tdwh":"\033[37m", # Dark White
  22. "tbbl":"\033[90m", # Bright Black
  23. "tbrd":"\033[91m", # Bright Red
  24. "tbgr":"\033[92m", # Bright Green
  25. "tbyl":"\033[93m", # Bright Yellow
  26. "tbbu":"\033[94m", # Bright Blue
  27. "tbma":"\033[95m", # Bright Magenta
  28. "tbcy":"\033[96m", # Bright Cyan
  29. "tbwh":"\033[97m", # Bright White
  30. # Background
  31. "bdbl":"\033[40m", # Dark Black
  32. "bdrd":"\033[41m", # Dark Red
  33. "bdgr":"\033[42m", # Dark Green
  34. "bdyl":"\033[43m", # Dark Yellow
  35. "bdbu":"\033[44m", # Dark Blue
  36. "bdma":"\033[45m", # Dark Magenta
  37. "bdcy":"\033[46m", # Dark Cyan
  38. "bdwh":"\033[47m", # Dark White
  39. "bbbl":"\033[100m", # Bright Black
  40. "bbrd":"\033[101m", # Bright Red
  41. "bbgr":"\033[102m", # Bright Green
  42. "bbyl":"\033[103m", # Bright Yellow
  43. "bbbu":"\033[104m", # Bright Blue
  44. "bbma":"\033[105m", # Bright Magenta
  45. "bbcy":"\033[106m", # Bright Cyan
  46. "bbwh":"\033[108m" # Bright White
  47. }
  48. def run():
  49. with open('TROUBLESOME_MODULES.json') as json_file:
  50. data = json.load(json_file)
  51. for module in data:
  52. try:
  53. e = "import "+module
  54. exec(e)
  55. except:
  56. print()
  57. print(" "+clr["bdrd"]+" Python Module '"+module+"' is not installed! "+clr["norm"])
  58. print(" The module is needed for: "+data[module]["reason"])
  59. print(" It's source code is available at: "+data[module]["source"])
  60. print(" And it's licensed under: "+data[module]["license"])
  61. print()
  62. print(" "+clr["bdgr"]+" WOULD YOU LIKE TO INSTALL IT? (yes/no) "+clr["norm"])
  63. print()
  64. yesno = input(":")
  65. if yesno.lower() in ["y", "yes"]:
  66. os.system(data[module]["install"])
  67. else:
  68. return
  69. if __name__ == "__main__":
  70. run()