diff --git a/tools/install_venv.py b/tools/install_venv.py index f8fb8fa2916..a33664930e8 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -52,8 +52,15 @@ def print_help(): def main(argv): - root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) - venv = os.path.join(root, '.venv') + if 'tools_path' in os.environ: + 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') test_requires = os.path.join(root, 'test-requirements.txt') py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) diff --git a/tools/with_venv.sh b/tools/with_venv.sh index 5fb07ea8ccb..8505e3ec519 100755 --- a/tools/with_venv.sh +++ b/tools/with_venv.sh @@ -14,6 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -TOOLS=`dirname $0` -VENV=$TOOLS/../.venv +tools_path=${tools_path:-$(dirname $0)} +venv_path=${venv_path:-${tools_path}} +venv_dir=${venv_name:-/../.venv} +TOOLS=${tools_path} +VENV=${venv:-${venv_path}/${venv_dir}} source $VENV/bin/activate && "$@"