Configure paths with MIC_LIBRARY_PATH and MIC_PLUGIN_DIR
authorŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 12 Nov 2013 09:29:58 +0000 (10:29 +0100)
committerGui Chen <gui.chen@intel.com>
Fri, 22 Nov 2013 02:54:25 +0000 (21:54 -0500)
Enable passing location of mic files via environment variables:
MIC_LIBRARY_PATH and MIC_PLUGIN_DIR to override values that are either
hardcoded (MIC_LIBRARY_PATH) or set in the global configuration file.

Change-Id: I601b06ba0e7953ba3882511af811a6f8cefa3585
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
mic/conf.py
mic/rt_util.py

index 5c14c5d..20dc75a 100644 (file)
@@ -43,8 +43,6 @@ class ConfigMgr(object):
                     "tmpdir": '/var/tmp/mic',
                     "cachedir": '/var/tmp/mic/cache',
                     "outdir": './mic-output',
-
-                    "plugin_dir": "/usr/lib/mic/plugins",
                     "arch": None, # None means auto-detect
                     "pkgmgr": "auto",
                     "name": "output",
@@ -144,6 +142,9 @@ class ConfigMgr(object):
             if section in self.DEFAULTS:
                 getattr(self, section).update(dict(parser.items(section)))
 
+        if os.getenv("MIC_PLUGIN_DIR"):
+            self.common["plugin_dir"] = os.environ["MIC_PLUGIN_DIR"]
+
         # append common section items to other sections
         for section in self.DEFAULTS.keys():
             if section != "common":
index c5a0c5c..41b607f 100644 (file)
@@ -185,8 +185,7 @@ def get_mic_modpath():
     return os.path.dirname(path)
 
 def get_mic_libpath():
-    # TBD: so far mic lib path is hard coded
-    return "/usr/lib/mic"
+    return os.getenv("MIC_LIBRARY_PATH", "/usr/lib/mic")
 
 # the hard code path is prepared for bootstrap
 def sync_mic(bootstrap, binpth = '/usr/bin/mic',