diff --git a/NEWS.rst b/NEWS.rst index 2d95ef77d13fd4c0a0cd7f964ac3d8705cbe1d52_TkVXUy5yc3Q=..40f1da7486da3901dca45c8604b10c9940290387_TkVXUy5yc3Q= 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -7,6 +7,8 @@ Add install option to do_tests, allowing to override installed modules. +Fix issues with documentation generation (incompatibility with expand) + 8.0.1 ----- diff --git a/common b/common index 2d95ef77d13fd4c0a0cd7f964ac3d8705cbe1d52_Y29tbW9u..40f1da7486da3901dca45c8604b10c9940290387_Y29tbW9u 100644 --- a/common +++ b/common @@ -23,6 +23,7 @@ OK="[${GREEN} OK${RESET} ]" RED="${esc}[31m" KO="[${esc}[41m${esc}[37m KO ${RESET}]" +WHITE_BOLD="${esc}[1;37m" function read_configuration_key () { # Read a configuration key from any ini file diff --git a/create_documentation b/create_documentation index 2d95ef77d13fd4c0a0cd7f964ac3d8705cbe1d52_Y3JlYXRlX2RvY3VtZW50YXRpb24=..40f1da7486da3901dca45c8604b10c9940290387_Y3JlYXRlX2RvY3VtZW50YXRpb24= 100755 --- a/create_documentation +++ b/create_documentation @@ -8,4 +8,6 @@ # # Version 8.0.1 +here=$(dirname $0) +source $here/common @@ -11,8 +13,5 @@ -# 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}}} +project_name=${DOC_PROJECT_NAME:-${CI_PROJECT_NAME:-${DRONE_REPO_NAME:-project_name}}} languages=(${LANGUAGES:-en}) format=html @@ -21,13 +20,8 @@ module_error=0 error=0 -# color stuff -autoload colors && colors -for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do - eval $COLOR='$fg_no_bold[${(L)COLOR}]' - eval BOLD_$COLOR='$fg_bold[${(L)COLOR}]' -done -eval RESET='$reset_color' +typeset -a odoo_modules +odoo_modules=("${(@s/ /)$(read_odoo_scripts_expandable_configuration_key modules " ")}") pushd $project_home @@ -31,12 +25,22 @@ pushd $project_home -if type "python3" > /dev/null; -then - odoo_modules="$(python3 -B -c "import configparser ; c = configparser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print (c.has_option('odoo_scripts', 'modules') and ' '.join(c.get('odoo_scripts', 'modules').split()) or '')")" -else - odoo_modules="$(python2 -B -c "import ConfigParser ; c = ConfigParser.SafeConfigParser() ; c.read('${project_home}/setup.cfg') ; print (c.has_option('odoo_scripts', 'modules') and ' '.join(c.get('odoo_scripts', 'modules').split()) or '')")" -fi +# set addons path +typeset -a addons_path +addons_path=() +for module_path in $odoo_modules ; +do + module_dir=$(dirname $module_path) + if (($addons_path[(Ie)$module_dir])); + then + # already in + else + addons_path+=($module_dir) + fi + unset module_dir +done +export ODOO_ADDONS_PATH=${(j:,:)addons_path} +unset addons_path # search where to copy modules documentation for doc_dir in doc docs; do @@ -47,7 +51,7 @@ done # Generate all modules documentation -for module_path in $(eval echo $odoo_modules) ; +for module_path in $odoo_modules ; do if [[ -d "$module_path" ]] ; then echo "" @@ -51,7 +55,7 @@ do if [[ -d "$module_path" ]] ; then echo "" - echo "${YELLOW}INFO${RESET} - Documentation for ${BOLD_WHITE}$module_path${RESET}" + echo "${INFO} Documentation for ${BOLD_WHITE}$module_path${RESET}" pushd $module_path module=$(basename $module_path) has_doc="" @@ -60,8 +64,8 @@ elif [ -e ".hg" ]; then branch="$(hg identify --branch)" else - echo "${RED}WARN${RESET} - Branch name not found" + echo "${WARN} Branch name not found" branch="default" fi for doc_dir in doc docs ; do if [[ -d $doc_dir && -e $doc_dir/Makefile ]]; then @@ -64,6 +68,6 @@ branch="default" fi for doc_dir in doc docs ; do if [[ -d $doc_dir && -e $doc_dir/Makefile ]]; then - echo "${YELLOW}INFO ${RESET} - Branch name: $branch" + echo "${INFO} Branch name: $branch" has_doc=True @@ -69,5 +73,5 @@ has_doc=True - echo ${YELLOW}INFO ${RESET} - Makefile found in $module_path/$doc_dir + echo ${INFO} Makefile found in $module_path/$doc_dir pushd $doc_dir # TODO read languages value from Makefile (at least available ones) for language in $languages ; do @@ -78,6 +82,6 @@ mkdir -p $dest_dir if [[ -d "_build/$format/$language" ]]; then - echo "${YELLOW}INFO ${RESET} - found _build/$format/$language/, copying from there" + echo "${INFO} found _build/$format/$language/, copying from there" cp --archive --recursive "_build/$format/$language/." "$dest_dir" else @@ -82,7 +86,7 @@ cp --archive --recursive "_build/$format/$language/." "$dest_dir" else - # this is only because some modules Makefile is not up to date - echo "${YELLOW}INFO ${RESET} - no _build/$format/$language/ found, copying from _build/$format/" + # this is only because some modules Makefile are not up to date + echo "${INFO} no _build/$format/$language/ found, copying from _build/$format/" cp --archive --recursive "_build/$format/." "$dest_dir" fi else @@ -86,7 +90,7 @@ cp --archive --recursive "_build/$format/." "$dest_dir" fi else - echo ${RED}ERROR${RESET} - Documentation generation failed for $module_path/$doc_dir + echo ${WARN} Documentation generation failed for $module_path/$doc_dir ((module_error++)) fi done @@ -95,7 +99,7 @@ rsync --recursive --copy-links --perms --times --group --owner $doc_dir/ "$superproject_modules_doc/$module" # generate autotodo for each module (to update pathes) if [[ -e $doc_dir/autotodo.py ]] ; then - echo "${YELLOW}INFO ${RESET} - running autotodo again from different path $superproject_modules_doc/$module for ${project_home}/${module_path}" + echo "${INFO} running autotodo again from different path $superproject_modules_doc/$module for ${project_home}/${module_path}" pushd "$superproject_modules_doc/$module" ./autotodo.py $(realpath --relative-to="." "${project_home}/${module_path}") .py TODO,FIXME,XXX popd @@ -104,7 +108,7 @@ fi done if [[ -z "$has_doc" ]] ; then - echo ${RED}WARN${RESET} - Missing documentation for $module_path + echo ${WARN} - Missing documentation for $module_path fi popd fi @@ -112,7 +116,7 @@ # Generate super project documentation echo "" -echo "${YELLOW}INFO ${RESET} - ${WHITE_BOLD}Super project${RESET} documentation generation" +echo "${INFO} ${WHITE_BOLD}Super project${RESET} documentation generation" # determine branch name if [ -n "$DRONE_BRANCH" ]; then @@ -122,6 +126,6 @@ elif [ -e ".hg" ]; then branch="$(hg id -b)" else - echo "${RED}WARN${RESET} - Super project branch name not found, using default" + echo "${WARN} Super project branch name not found, using default" branch="default" fi @@ -126,6 +130,6 @@ branch="default" fi -echo "${YELLOW}INFO ${RESET} - Super project branch name: $branch" +echo "${INFO} Super project branch name: $branch" for doc_dir in doc docs; do if [[ -d "$doc_dir" ]] ; then @@ -136,7 +140,7 @@ make $format LANGUAGE=${language} BUILDDIR=_build SPHINXOPTS="-w _build/warnings.out" if [[ $? -eq 0 ]] ; then dest_dir=$out_dir/$project_name/$language/$branch - echo "${YELLOW}INFO ${RESET} - Documentation generation done for $doc_dir (superproject), copy to $dest_dir" + echo "${INFO} Documentation generation done for $doc_dir (superproject), copy to $dest_dir" mkdir -p $dest_dir cp --recursive --archive _build/$format/$language/. $dest_dir else @@ -140,7 +144,7 @@ mkdir -p $dest_dir cp --recursive --archive _build/$format/$language/. $dest_dir else - echo "${RED}FATAL${RESET} - Documentation generation failed for $doc_dir (superproject)" + echo "${FATAL} Documentation generation failed for $doc_dir (superproject)" ((error++)) fi done @@ -151,7 +155,7 @@ popd if [[ $module_error -gt 0 ]]; then - echo "${RED}ERROR${RESET} - $module_error module(s) with errors" + echo "${WARN} $module_error module(s) with errors" fi # create a metrics file if [[ "$CI" = "true" ]]; then