From 36e90ebb2ebd8a186ca4568f3cdcc5c82123f09b Mon Sep 17 00:00:00 2001 From: Ekaterina Fedorova Date: Tue, 24 Sep 2013 14:46:30 +0400 Subject: [PATCH] Cherry-pick from master Add murano-api to PYTHONPATH It's required during running from command line Change-Id: Ibb4bf0114fb54bb6e14735dd29c778d2fa63be70 --- muranoapi/cmd/api.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/muranoapi/cmd/api.py b/muranoapi/cmd/api.py index d97fbf9c1..182435ef9 100644 --- a/muranoapi/cmd/api.py +++ b/muranoapi/cmd/api.py @@ -13,8 +13,16 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - +import os import sys +# If ../muranoapi/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(__file__), + os.pardir, + os.pardir, + os.pardir)) +if os.path.exists(os.path.join(possible_topdir, 'muranoapi', '__init__.py')): + sys.path.insert(0, possible_topdir) from muranoapi.common import config from muranoapi.common.service import TaskResultHandlerService