# HG changeset patch # User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr> # Date 1594220529 -7200 # Wed Jul 08 17:02:09 2020 +0200 # Node ID e483c27a65e421f164be898407b15a52faaac68c # Parent 0980990f990b3240c1b5082b770d53ddbe93cb90 🔨 change documentation generation diff --git a/NEWS.rst b/NEWS.rst --- a/NEWS.rst +++ b/NEWS.rst @@ -2,6 +2,11 @@ History ======= +4.0 +--- + +Change how documentation is generated, and do not exit with an error code on module generation errors. + 3.3 --- diff --git a/create_documentation b/create_documentation --- a/create_documentation +++ b/create_documentation @@ -5,9 +5,9 @@ # It needs: # - openerp to be installed -# +# -# Version 3.3 +# Version 4.0 here=$(dirname $0) project_home=$(cd $here && cd .. && echo $PWD) @@ -18,6 +18,7 @@ format=html out_dir=${project_home}/_build/$format +module_error=0 error=0 # color stuff @@ -45,7 +46,7 @@ fi done -# modules documentation +# Generate all modules documentation for module_path in $(eval echo $odoo_modules) ; do if [[ -d "$module_path" ]] ; then @@ -57,7 +58,7 @@ elif [ -e ".hg" ]; then branch="$(hg identify --branch)" else - echo "${RED}WARN${RESET} - Branch name not found" + echo "${RED}WARN${RESET} - Branch name not found" branch="default" fi for doc_dir in doc docs ; do @@ -66,35 +67,33 @@ has_doc=True echo ${YELLOW}INFO ${RESET} - Makefile found in $dir/$module_path/$doc_dir pushd $doc_dir - # TODO read value from Makefile + # TODO read languages value from Makefile for language in $languages ; do - make -e SPHINXOPTS=-Dlanguage=${language} $format + make $format LANGUAGE=${language} BUILDDIR=_build if [[ $? -eq 0 ]] ; then - # TODO read value from Makefile - builddir=_build - dest_dir=$out_dir/$module/$language/$branch - echo ${GREEN}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 + dest_dir=$out_dir/$module/$language/$branch + echo ${GREEN}INFO ${RESET} - Documentation generation done for $dir/$module_path/$doc_dir, copy to $dest_dir + mkdir -p $dest_dir + cp -r _build/$format/. $dest_dir else - echo ${RED}ERROR${RESET} - Documentation generation failed for $dir/$module_path/$doc_dir - ((error++)) + echo ${RED}ERROR${RESET} - Documentation generation failed for $dir/$module_path/$doc_dir + ((module_error++)) fi done popd # copy documentation in super project - rsync -rLptgoD $doc_dir/ "$superproject_modules_doc/$module" + rsync --recursive --copy-links --perms --times --group --owner --include="*.rst" $doc_dir/ "$superproject_modules_doc/$module" # TODO translation will not work when copying like that. fi done if [[ -z "$has_doc" ]] ; then - echo ${RED}WARN${RESET} - Missing documentation for $dir/$module_path + echo ${RED}WARN${RESET} - Missing documentation for $dir/$module_path fi popd fi done -# super project documentation +# Generate super project documentation # determine branch name if [ -n "$DRONE_BRANCH" ]; then @@ -104,8 +103,8 @@ elif [ -e ".hg" ]; then branch="$(hg id -b)" else - echo "${RED}WARN${RESET} - Branch name not found" - branch="unknown" + echo "${RED}WARN${RESET} - Branch name not found, using default" + branch="default" fi echo "${YELLOW}INFO ${RESET} - Branch name: $branch" @@ -113,17 +112,15 @@ if [[ -d "$doc_dir" ]] ; then pushd $doc_dir for language in $languages ; do - make -e SPHINXOPTS=-Dlanguage=${language} $format + make $format LANGUAGE=${language} BUILDDIR=_build if [[ $? -eq 0 ]] ; then - # TODO read value from Makefile - builddir=_build - dest_dir=$out_dir/$project_name/$language/$branch - echo "${YELLOW}INFO ${RESET} - Documentation generation done for $doc_dir (superproject), copy to $dest_dir" - mkdir -p $dest_dir - cp -r $builddir/$format/. $dest_dir + dest_dir=$out_dir/$project_name/$language/$branch + echo "${YELLOW}INFO ${RESET} - Documentation generation done for $doc_dir (superproject), copy to $dest_dir" + mkdir -p $dest_dir + cp --recursive --archive _build/$format/$language/. $dest_dir else - echo "${RED}ERROR${RESET} - Documentation generation failed for $doc_dir (superproject)" - ((error++)) + echo "${RED}ERROR${RESET} - Documentation generation failed for $doc_dir (superproject)" + ((error++)) fi done popd diff --git a/do_tests b/do_tests --- a/do_tests +++ b/do_tests @@ -13,7 +13,7 @@ # # - access to pg database # -# Version 3.3 +# Version 4.0 here=$(dirname $0) project_home=$(cd $here && cd .. && echo $PWD) diff --git a/doc/Makefile b/doc/Makefile --- a/doc/Makefile +++ b/doc/Makefile @@ -23,7 +23,7 @@ # used to update *.po files update_locale: Makefile gettext - @sphinx-intl update -p "$(BUILDDIR)$(BUILDDIRSUFFIX)/gettext" -l fr + @sphinx-intl update -p "$(BUILDDIR)$(BUILDDIRSUFFIX)/gettext" -l $(LANGUAGE) # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). diff --git a/odoo_scripts/do_tests.py b/odoo_scripts/do_tests.py --- a/odoo_scripts/do_tests.py +++ b/odoo_scripts/do_tests.py @@ -4,7 +4,7 @@ isort:skip_file """ -# Version 3.3 +# Version 4.0 import argparse from configparser import ConfigParser import logging diff --git a/odoo_scripts/docker_build.py b/odoo_scripts/docker_build.py --- a/odoo_scripts/docker_build.py +++ b/odoo_scripts/docker_build.py @@ -2,7 +2,7 @@ # vim: set shiftwidth=4 softtabstop=4: """Script to locally build a docker image """ -# Version 3.3 +# Version 4.0 import datetime import json import logging diff --git a/odoo_scripts/docker_dev_start.py b/odoo_scripts/docker_dev_start.py --- a/odoo_scripts/docker_dev_start.py +++ b/odoo_scripts/docker_dev_start.py @@ -5,7 +5,7 @@ isort:skip_file """ -# Version 3.3 +# Version 4.0 import argparse import atexit from configparser import ConfigParser diff --git a/odoo_scripts/import_base_import.py b/odoo_scripts/import_base_import.py --- a/odoo_scripts/import_base_import.py +++ b/odoo_scripts/import_base_import.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Imports CSV files into an Odoo server via Odoo import wizard. """ -# Version 3.3 +# Version 4.0 import hashlib import hmac import logging diff --git a/odoo_scripts/import_jsonrpc.py b/odoo_scripts/import_jsonrpc.py --- a/odoo_scripts/import_jsonrpc.py +++ b/odoo_scripts/import_jsonrpc.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Imports CSV files into an Odoo server by using JSONRPC. """ -# Version 3.3 +# Version 4.0 import csv import logging import sys diff --git a/odoo_scripts/import_sql.py b/odoo_scripts/import_sql.py --- a/odoo_scripts/import_sql.py +++ b/odoo_scripts/import_sql.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Imports CSV files into an Oddo database using SQL. """ -# Version 3.3 +# Version 4.0 import csv import logging import sys diff --git a/run_tests b/run_tests --- a/run_tests +++ b/run_tests @@ -5,7 +5,7 @@ # # Either provide the name of the database (first argument) or it will default to <project>_test # The DB user can be overriden by setting ODOO_SCRIPTS_DB_USER. -# Version 3.3 +# Version 4.0 here=$(dirname $0) project_home=$(cd $here && cd .. && echo $PWD) if ! type python3 > /dev/null; then diff --git a/setup.cfg b/setup.cfg --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.3 +current_version = 4.0 parse = (?P<major>\d+)\.(?P<minor>\d+) serialize = {major}.{minor} diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="odoo_scripts", - version="3.3", + version="4.0", long_description=long_description, long_description_content_type="text/x-rst", author="XCG Consulting", diff --git a/start b/start --- a/start +++ b/start @@ -6,7 +6,7 @@ # You can set ODOO_DATA_DIR and ODOO_DB_HOST if you want to avoid using the default value ($HOME/var/tmp and localhost) # ODOO_TYPE can be set instead of putting it in setup.cfg # -# Version 3.3 +# Version 4.0 here=$(dirname "$0") project_home=$(cd "$here" && cd .. && echo "$PWD") if [ -x "$(command -v python3)" ];