Use tools_path/venv environment variables in install_venv

In the run_tests.sh, it export tools_path/venv/venv_path.
In the install_venv.sh, to get venv value in environ values. In
the with_venv.sh, to get correct envirion values.

Change-Id: Ia041937eaa8cf2194a929c846a7a96312a641ac5
Partial-Bug: #1535514
This commit is contained in:
Einst Crazy 2016-01-19 04:07:41 +00:00
parent e0beb2be22
commit 858389db7c
2 changed files with 14 additions and 4 deletions

View File

@ -52,8 +52,15 @@ def print_help():
def main(argv): def main(argv):
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) if 'tools_path' in os.environ:
venv = os.path.join(root, '.venv') root = os.environ['tools_path']
else:
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if 'venv' in os.environ:
venv = os.environ['venv']
else:
venv = os.path.join(root, '.venv')
pip_requires = os.path.join(root, 'requirements.txt') pip_requires = os.path.join(root, 'requirements.txt')
test_requires = os.path.join(root, 'test-requirements.txt') test_requires = os.path.join(root, 'test-requirements.txt')
py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])

View File

@ -14,6 +14,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
TOOLS=`dirname $0` tools_path=${tools_path:-$(dirname $0)}
VENV=$TOOLS/../.venv venv_path=${venv_path:-${tools_path}}
venv_dir=${venv_name:-/../.venv}
TOOLS=${tools_path}
VENV=${venv:-${venv_path}/${venv_dir}}
source $VENV/bin/activate && "$@" source $VENV/bin/activate && "$@"