# HG changeset patch
# User Houzefa Abbasbhay <houzefa.abba@xcg-consulting.fr>
# Date 1491913985 -7200
#      Tue Apr 11 14:33:05 2017 +0200
# Node ID b5229d5511cfaa237b597469557efbdcd7a75f6f
# Parent  1fc1a46843b6438665d38c9cfb379488f58e2cd9
create_documentation: Fix paths of per-module doc

In the loop:
- Rename the "module" variable to "module_path".
- Set up a new "module" variable that contains nothing but the actual module
  name.

diff --git a/HISTORY.rst b/HISTORY.rst
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -2,6 +2,8 @@
 History
 =======
 
+- create_documentation: Fix paths of per-module documentation.
+
 2.10
 ----
 
diff --git a/create_documentation b/create_documentation
--- a/create_documentation
+++ b/create_documentation
@@ -56,15 +56,16 @@
 done
 
 odoo_modules="$($python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print(c.has_section('odoo_scripts') and c.has_option('odoo_scripts', 'modules') and ' '.join(c.get('odoo_scripts', 'modules', '').split()) or ' '.join('%s/*' % mod for mod in c.get('odoo_scripts', 'addon_dirs').split()) )")"
-for module in $(eval echo $odoo_modules) ;
+for module_path in $(eval echo $odoo_modules) ;
 do
-    if [[ -d "$module" ]] ; then
-        pushd $module
+    if [[ -d "$module_path" ]] ; then
+        pushd $module_path
+        module=$(basename $module_path)
         has_doc=""
         for doc_dir in doc docs ; do
 	    if [[ -d $doc_dir && -e $doc_dir/Makefile ]]; then
 		has_doc=True
-		echo ${YELLOW}INFO ${RESET} - Makefile found in $dir/$module/$doc_dir
+		echo ${YELLOW}INFO ${RESET} - Makefile found in $dir/$module_path/$doc_dir
 		if [ -e ".git" ]; then
 		    branch="$(git rev-parse --abbrev-ref HEAD)"
 		elif [ -e ".hg" ]; then
@@ -80,18 +81,18 @@
 		    builddir=_build
 		    dest_dir=$out_dir/$module/$language/$branch
 		    if [[ $? -eq 0 ]] ; then
-			echo ${YELLOW}INFO ${RESET} - Documentation generation done for $dir/$module/$doc_dir, copy to $dest_dir
+			echo ${YELLOW}INFO ${RESET} - Documentation generation done for $dir/$module_path/$doc_dir, copy to $dest_dir
 			mkdir -p $dest_dir
 			cp -r $builddir/$format/. $dest_dir
 		    else
-			echo ${RED}ERROR${RESET} - Documentation generation failed for $dir/$module/$doc_dir
+			echo ${RED}ERROR${RESET} - Documentation generation failed for $dir/$module_path/$doc_dir
 		    fi
 		done
 		popd
 	    fi
 	done
 	if [[ -z "$has_doc" ]] ; then
-	    echo ${RED}ERROR${RESET} - Missing documentation for $dir/$module
+	    echo ${RED}ERROR${RESET} - Missing documentation for $dir/$module_path
 	fi
 	popd
     fi