فهرست منبع

HUE_APP_REG_DIR and HUE_PTH_DIR configurable at compile time

Roman Shaposhnik 12 سال پیش
والد
کامیت
d55adbc
3فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 6 0
      tools/app_reg/common.py
  2. 1 1
      tools/app_reg/pth.py
  3. 1 1
      tools/app_reg/registry.py

+ 6 - 0
tools/app_reg/common.py

@@ -27,6 +27,12 @@ INSTALL_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '.
 # The apps location
 APPS_ROOT = os.path.join(INSTALL_ROOT, 'apps')
 
+# Directory holding app.reg
+HUE_APP_REG_DIR = os.environ.get("HUE_APP_REG_DIR", INSTALL_ROOT) 
+
+# Directory holding hue.pth
+HUE_PTH_DIR = os.environ.get('HUE_PTH_DIR', None)
+
 # The Hue config directory
 HUE_CONF_DIR = os.path.join(INSTALL_ROOT, 'desktop', 'conf')
 

+ 1 - 1
tools/app_reg/pth.py

@@ -44,7 +44,7 @@ def _get_pth_filename():
   Location can be defined via HUE_PTH_DIR environment variable.
   May raise SystemError if the virtual env is absent.
   """
-  pth_dir = os.environ.get('HUE_PTH_DIR', None)
+  pth_dir = common.HUE_PTH_DIR
   if pth_dir:
     return os.path.join(pth_dir, PTH_FILE)
   else:

+ 1 - 1
tools/app_reg/registry.py

@@ -37,7 +37,7 @@ class AppRegistry(object):
   """
   def __init__(self):
     """Open the existing registry"""
-    self._reg_path = os.path.join(os.environ.get("HUE_APP_REG_DIR", common.INSTALL_ROOT), 'app.reg')
+    self._reg_path = os.path.join(common.HUE_APP_REG_DIR, 'app.reg')
     self._initialized = False
     self._apps = { }    # Map of name -> HueApp
     self._open()