Skip to content
Snippets Groups Projects
Commit 47bb259df284 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

create_documentation: only create documentation for used modules, reusing the...

create_documentation: only create documentation for used modules, reusing the setup.cfg key defined for create_archive if it is present
parent 5b7f858e7dcc
No related branches found
No related tags found
No related merge requests found
......@@ -55,22 +55,25 @@
fi
done
for dir in $($python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print(' '.join(c.get('odoo_scripts', 'addon_dirs', '').split()))") ; do
pushd $dir
for module in * ; do
if [[ -d "$module" ]] ; then
pushd $module
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
if [ -e ".git" ]; then
branch="$(git rev-parse --abbrev-ref HEAD)"
elif [ -e ".hg" ]; then
branch="$(hg id -b)"
else
branch="default"
fi
pushd $doc_dir
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) ;
do
if [[ -d "$module" ]] ; then
pushd $module
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
if [ -e ".git" ]; then
branch="$(git rev-parse --abbrev-ref HEAD)"
elif [ -e ".hg" ]; then
branch="$(hg id -b)"
else
branch="default"
fi
pushd $doc_dir
# TODO read value from Makefile
for language in "en" ; do
make -e SPHINXOPTS=-Dlanguage=${language} $format
# TODO read value from Makefile
......@@ -76,20 +79,13 @@
# TODO read value from Makefile
for language in "en" ; do
make -e SPHINXOPTS=-Dlanguage=${language} $format
# TODO read value from Makefile
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
mkdir -p $dest_dir
cp -r $builddir/$format/. $dest_dir
else
echo ${RED}ERROR${RESET} - Documentation generation failed for $dir/$module/$doc_dir
fi
done
popd
fi
done
if [[ -z "$has_doc" ]] ; then
echo ${RED}ERROR${RESET} - Missing documentation for $dir/$module
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
mkdir -p $dest_dir
cp -r $builddir/$format/. $dest_dir
else
echo ${RED}ERROR${RESET} - Documentation generation failed for $dir/$module/$doc_dir
fi
done
popd
fi
......@@ -95,3 +91,5 @@
fi
popd
done
if [[ -z "$has_doc" ]] ; then
echo ${RED}ERROR${RESET} - Missing documentation for $dir/$module
fi
......@@ -97,6 +95,6 @@
fi
done
popd
popd
fi
done
popd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment