_syspaths.py 1.2 KB

12345678910111213141516171819202122232425262728
  1. import os
  2. import sys
  3. # http://stackoverflow.com/a/404750
  4. # determine if application is a script file or frozen exe
  5. if getattr(sys, "frozen", False):
  6. application_path = os.path.dirname(sys.executable)
  7. elif __file__:
  8. application_path = os.path.dirname(__file__)
  9. ROOT_DIR = application_path.split("bin/appdata")[0]
  10. # Copied from syspaths.py
  11. SHARE_DIR = os.path.join(ROOT_DIR, "usr", "share", "salt")
  12. CONFIG_DIR = os.path.join(ROOT_DIR, "etc")
  13. CACHE_DIR = os.path.join(ROOT_DIR, "var", "cache", "salt")
  14. SOCK_DIR = os.path.join(ROOT_DIR, "var", "run", "salt")
  15. SRV_ROOT_DIR = os.path.join(ROOT_DIR, "srv")
  16. BASE_FILE_ROOTS_DIR = os.path.join(SRV_ROOT_DIR, "salt")
  17. BASE_PILLAR_ROOTS_DIR = os.path.join(SRV_ROOT_DIR, "pillar")
  18. BASE_THORIUM_ROOTS_DIR = os.path.join(SRV_ROOT_DIR, "thorium")
  19. BASE_MASTER_ROOTS_DIR = os.path.join(SRV_ROOT_DIR, "salt-master")
  20. LOGS_DIR = os.path.join(ROOT_DIR, "var", "log", "salt")
  21. PIDFILE_DIR = os.path.join(ROOT_DIR, "var", "run")
  22. SPM_PARENT_PATH = os.path.join(ROOT_DIR, "spm")
  23. SPM_FORMULA_PATH = os.path.join(SPM_PARENT_PATH, "salt")
  24. SPM_PILLAR_PATH = os.path.join(SPM_PARENT_PATH, "pillar")
  25. SPM_REACTOR_PATH = os.path.join(SPM_PARENT_PATH, "reactor")