summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2012-04-24 17:35:24 +0800
committerGui Chen <gui.chen@intel.com>2012-04-28 14:06:38 +0800
commit14d63563d5f6d11e36e7eeb279cec401df0f4d84 (patch)
tree5db476dcb3234a616cf999cdd2569cefb75d4c49 /setup.py
parenta5df16028eb1e1a221919b953a92e4434ccc9fbb (diff)
downloadmic-14d63563d5f6d11e36e7eeb279cec401df0f4d84.tar.gz
mic-14d63563d5f6d11e36e7eeb279cec401df0f4d84.tar.bz2
mic-14d63563d5f6d11e36e7eeb279cec401df0f4d84.zip
detect site conf file, use /etc/mic/mic.conf by default
Signed-off-by: Gui Chen <gui.chen@intel.com>
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 22706fd..e4dee0f 100644
--- a/setup.py
+++ b/setup.py
@@ -58,7 +58,7 @@ IMAGER_PLUGINS = glob.glob(os.path.join("plugins", "imager", "*.py"))
BACKEND_PLUGINS = glob.glob(os.path.join("plugins", "backend", "*.py"))
# the following code to do a simple parse for '--prefix' opts
-prefix = '/usr'
+prefix = sys.prefix
is_next = False
for arg in sys.argv:
if is_next:
@@ -66,10 +66,13 @@ for arg in sys.argv:
break
if '--prefix=' in arg:
prefix = arg[9:]
+ break
elif '--prefix' == arg:
is_next = True
-if prefix == '/usr':
+# expand the path, for user may type some unexcepted format
+prefix = os.path.abspath(os.path.expanduser(prefix)).rstrip('/')
+if prefix.lstrip('/') == 'usr':
etc_prefix = '/etc'
else:
etc_prefix = os.path.join(prefix, 'etc')