From 94a1041f0e787a6dcb3dfeb3db65fc960ffed6d8 Mon Sep 17 00:00:00 2001 From: Gui Chen Date: Tue, 21 Aug 2012 14:16:19 +0800 Subject: [PATCH] detect python site dir inside bootstrap Signed-off-by: Gui Chen --- mic/rt_util.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mic/rt_util.py b/mic/rt_util.py index 859eb7a..3193c99 100644 --- a/mic/rt_util.py +++ b/mic/rt_util.py @@ -18,6 +18,7 @@ from __future__ import with_statement import os import sys +import glob import re import shutil import subprocess @@ -131,6 +132,15 @@ def sync_mic(bootstrap, binpth = '/usr/bin/mic', 'conf': '/etc/mic/mic.conf', } + if not os.path.exists(_path(pylib)): + pyptn = '/usr/lib/python?.?/site-packages' + pylibs = glob.glob(_path(pyptn)) + if pylibs: + pylib = pylibs[0].replace(bootstrap, '') + else: + raise errors.BootstrapError("Can't find python site dir in: %s" % + bootstrap) + for key, value in micpaths.items(): try: safecopy(value, _path(eval(key)), False, ["*.pyc", "*.pyo"]) -- 2.7.4