# HG changeset patch
# User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr>
# Date 1595512895 -7200
#      Thu Jul 23 16:01:35 2020 +0200
# Node ID cf0388ccc9c348e7b1f62b8d39508ae2851066a2
# Parent  15895d32a3f842c6002c22c8d6ac795d7a105599
🔨 shell script do not assume they are called from a directory in the project home, but called from the project home while the scripts themeselves might be somewhere else

Other scripts already assumes that so it should not have much impact, it allows more possibility for the location of the scripts

diff --git a/NEWS.rst b/NEWS.rst
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -2,6 +2,11 @@
 History
 =======
 
+4.1
+---
+
+Shell scripts stop assuming that they are in a directory inside the superproject, but assume they are called from the superproject directory instead.
+
 4.0
 ---
 
diff --git a/create_documentation b/create_documentation
--- a/create_documentation
+++ b/create_documentation
@@ -9,8 +9,8 @@
 
 # Version 4.0
 
-here=$(dirname $0)
-project_home=$(cd $here && cd .. && echo $PWD)
+# assume we are called from the project home
+project_home=$PWD
 project_name_from_home=$(basename $project_home)
 project_name=${DOC_PROJECT_NAME:-${CI_PROJECT_NAME:-${DRONE_REPO_NAME:-$project_name_from_home}}}
 languages=(${LANGUAGES:-en})
@@ -111,10 +111,10 @@
 elif [ -e ".hg" ]; then
     branch="$(hg id -b)"
 else
-    echo "${RED}WARN${RESET} - Branch name not found, using default"
+    echo "${RED}WARN${RESET} - Super project branch name not found, using default"
     branch="default"
 fi
-echo "${YELLOW}INFO ${RESET} - Branch name: $branch"
+echo "${YELLOW}INFO ${RESET} - Super project branch name: $branch"
 
 for doc_dir in doc docs; do
     if [[ -d "$doc_dir" ]] ; then
diff --git a/do_tests b/do_tests
--- a/do_tests
+++ b/do_tests
@@ -16,7 +16,8 @@
 # Version 4.0
 
 here=$(dirname $0)
-project_home=$(cd $here && cd .. && echo $PWD)
+# assume we are called from the project home
+project_home=$PWD
 if ! type python3 > /dev/null; then
     python="python2"
 else
diff --git a/run_tests b/run_tests
--- a/run_tests
+++ b/run_tests
@@ -7,7 +7,8 @@
 # The DB user can be overriden by setting ODOO_SCRIPTS_DB_USER.
 # Version 4.0
 here=$(dirname $0)
-project_home=$(cd $here && cd .. && echo $PWD)
+# assume we are called from the project home
+project_home=$PWD
 if ! type python3 > /dev/null; then
     python="python2"
 else
diff --git a/start b/start
--- a/start
+++ b/start
@@ -7,8 +7,10 @@
 # ODOO_TYPE can be set instead of putting it in setup.cfg
 #
 # Version 4.0
+
 here=$(dirname "$0")
-project_home=$(cd "$here" && cd .. && echo "$PWD")
+# assume we are called from the project home
+project_home=$PWD
 if [ -x "$(command -v python3)" ];
 then
     python="python3"