From 87e7df1f90f49dc3f812f0d032ee9308138d1c2c Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 30 Jun 2020 10:25:07 +0100 Subject: [PATCH] Support editable virtualenv installation for development An editable installation allows changes to be made to the source code directly, and have those changes applied immediately without having to reinstall. pip install -e /path/to/kolla-ansible Change-Id: I023d96d25edd9d2fafd4415743e298af72a861a1 (cherry picked from commit 5fb37ae58494cda74fba49ade43d082fb6b69288) --- tools/kolla-ansible | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/kolla-ansible b/tools/kolla-ansible index 22bf919d95..d37c49d76f 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -66,7 +66,12 @@ function find_base_dir { elif [[ ${dir_name} == "/usr/local/bin" ]]; then BASEDIR=/usr/local/share/kolla-ansible elif [[ -n ${VIRTUAL_ENV} ]] && [[ ${dir_name} == "${VIRTUAL_ENV}/bin" ]]; then - BASEDIR="${VIRTUAL_ENV}/share/kolla-ansible" + if test -f ${VIRTUAL_ENV}/lib/python*/site-packages/kolla-ansible.egg-link; then + # Editable install. + BASEDIR="$(head -n1 ${VIRTUAL_ENV}/lib/python*/site-packages/kolla-ansible.egg-link)" + else + BASEDIR="${VIRTUAL_ENV}/share/kolla-ansible" + fi else BASEDIR="$(dirname ${dir_name})" fi