Merge "Update heat-translator requirement"
[parser.git] / tools / parser_install.sh
1 #!/bin/bash -e
2 ##############################################################################
3 # Copyright (c) 2016 ZTE Corporation.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set +e
12 BASE_WORK_DIR=$(cd $(dirname $0) && pwd)
13
14 OPNFV_REPO_DIR=${1:-""}
15
16 # start syslog for loghander
17 service rsyslog restart && echo "syslog start successfully"
18
19 # install requirements for parser
20 if [ -n "${OPNFV_REPO_DIR}" ]; then
21     echo " OPNFV repository directory is ${OPNFV_REPO_DIR}"
22     pip install -r ${OPNFV_REPO_DIR}/parser/tosca2heat/tosca-parser/requirements.txt
23     pip install -r ${OPNFV_REPO_DIR}/parser/tosca2heat/heat-translator/requirements.txt
24 else
25     echo "No input for OPNFV repository directory, will use local directory"
26     pip install -r ${BASE_WORK_DIR}/../tosca2heat/tosca-parser/requirements.txt
27     pip install -r ${BASE_WORK_DIR}/../tosca2heat/heat-translator/requirements.txt
28 fi
29
30 # uninstall other tosca-parser and heat-translator for parser
31 pip uninstall -y tosca-parser
32 pip uninstall -y heat-translator
33
34 # install parser
35 if [ -n "${OPNFV_REPO_DIR}" ]; then
36     cd ${OPNFV_REPO_DIR}/parser/tosca2heat/heat-translator && python setup.py install
37     cd ${OPNFV_REPO_DIR}/parser/tosca2heat/tosca-parser && python setup.py install
38 else
39     cd ${BASE_WORK_DIR}/../tosca2heat/heat-translator && python setup.py install
40     cd ${BASE_WORK_DIR}/../tosca2heat/tosca-parser && python setup.py install
41 fi