bin_tool.py 809 B

12345678910111213141516171819202122232425262728293031
  1. import sys
  2. import subprocess
  3. from enum import Enum
  4. # get system information
  5. # I wanted a C-like enum
  6. WINDOWS, LINUX = range(0, 2)
  7. SYSTEM_OS = WINDOWS
  8. if (sys.platform == "linux"):
  9. SYSTEM_OS = LINUX
  10. # ~ print(SYSTEM_OS)
  11. # function to execute binaries
  12. def exec_subprocess(str_list):
  13. print("Process running: %s" % (str_list[0]))
  14. return subprocess.run(str_list, capture_output = True, text = True)
  15. # setup binary tools
  16. geckoloader_path = None
  17. wit_path = None
  18. if (SYSTEM_OS == WINDOWS):
  19. geckoloader_path = ["py", "-3.8", "tools/geckoloader/GeckoLoader.py"]
  20. wit_path = "tools/wit/windows/wit.exe"
  21. elif (SYSTEM_OS == LINUX):
  22. geckoloader_path = ["python3.8", "tools/geckoloader/GeckoLoader.py"]
  23. wit_path = "tools/wit/linux/wit"
  24. # ~ exec_subprocess(wit_path)
  25. # ~ exec_subprocess(geckoloader_path)