[FIX] script python: missing color log error
This commit is contained in:
parent
6d0c03dc25
commit
ea9be9b2ca
36 changed files with 194 additions and 89 deletions
|
|
@ -1,19 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
source ./.venv/bin/activate
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
CONFIG_PATH="./config.conf"
|
||||
ORIGIN_CONFIG_PATH=CONFIG_PATH
|
||||
if [ ! -f "${CONFIG_PATH}" ]; then
|
||||
CONFIG_PATH="/etc/odoo/odoo.conf"
|
||||
if [ ! -f "${CONFIG_PATH}" ]; then
|
||||
echo "Cannot find ERPLibre configuration ${ORIGIN_CONFIG_PATH}, did you install ERPLibre? > make install"
|
||||
echo "${Red}Cannot find${Color_Off} ERPLibre configuration ${ORIGIN_CONFIG_PATH}, did you install ERPLibre? > make install"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
coverage run -p ./odoo/odoo-bin -c ${CONFIG_PATH} --limit-time-real 99999 --limit-time-cpu 99999 $@
|
||||
coverage run -p ./odoo/odoo-bin -c "${CONFIG_PATH}" --limit-time-real 99999 --limit-time-cpu 99999 "$@"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error coverage_run.sh"
|
||||
echo "${Red}Error${Color_Off} run.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
8
run.sh
8
run.sh
|
|
@ -1,22 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
source ./.venv/bin/activate
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
CONFIG_PATH="./config.conf"
|
||||
ORIGIN_CONFIG_PATH=CONFIG_PATH
|
||||
if [ ! -f "${CONFIG_PATH}" ]; then
|
||||
CONFIG_PATH="/etc/odoo/odoo.conf"
|
||||
if [ ! -f "${CONFIG_PATH}" ]; then
|
||||
echo "Cannot find ERPLibre configuration ${ORIGIN_CONFIG_PATH}, did you install ERPLibre? > make install"
|
||||
echo "${Red}Cannot find${Color_Off} ERPLibre configuration ${ORIGIN_CONFIG_PATH}, did you install ERPLibre? > make install"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
python3 ./odoo/odoo-bin -c ${CONFIG_PATH} --limit-time-real 99999 --limit-time-cpu 99999 --limit-memory-hard=0 "$@"
|
||||
python3 ./odoo/odoo-bin -c "${CONFIG_PATH}" --limit-time-real 99999 --limit-time-cpu 99999 --limit-memory-hard=0 "$@"
|
||||
# When need more memory RAM for instance by force
|
||||
#python3 ./odoo/odoo-bin -c ${CONFIG_PATH} --limit-time-real 99999 --limit-time-cpu 99999 --limit-memory-soft=8589934592 --limit-memory-hard=10737418240 $@
|
||||
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error run.sh"
|
||||
echo "${Red}Error${Color_Off} run.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# Argument 3 is config
|
||||
if [[ $# -eq 3 ]]; then
|
||||
./script/addons/check_addons_exist.py -m "$2" -c "$3"
|
||||
|
|
@ -7,7 +10,7 @@ else
|
|||
fi
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error check_addons_exist.py into coverage_install_addons.sh"
|
||||
echo -e "${Red}Error${Color_Off} check_addons_exist.py into coverage_install_addons.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -21,6 +24,6 @@ fi
|
|||
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error coverage_run.sh into coverage_install_addons.sh"
|
||||
echo -e "${Red}Error${Color_Off} coverage_run.sh into coverage_install_addons.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# Argument 3 is config
|
||||
if [[ $# -eq 3 ]]; then
|
||||
./script/addons/check_addons_exist.py -m "$2" -c "$3"
|
||||
|
|
@ -7,7 +10,7 @@ else
|
|||
fi
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error check_addons_exist.py into coverage_install_addons_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} check_addons_exist.py into coverage_install_addons_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -21,6 +24,6 @@ fi
|
|||
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error coverage_run.sh into coverage_install_addons_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} coverage_run.sh into coverage_install_addons_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# "$1" code_generator_name
|
||||
./script/database/db_restore.py --database "$1"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/database/db_restore.py into coverage_install_addons_restore_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/database/db_restore.py into coverage_install_addons_restore_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./script/addons/coverage_install_addons_dev.sh "$1" "$1"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/addons/coverage_install_addons_dev.sh into coverage_install_addons_restore_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/addons/coverage_install_addons_dev.sh into coverage_install_addons_restore_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# Argument 3 is config
|
||||
if [[ $# -eq 3 ]]; then
|
||||
./script/addons/check_addons_exist.py -m "$2" -c "$3"
|
||||
|
|
@ -7,7 +10,7 @@ else
|
|||
fi
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error check_addons_exist.py into install_addons.sh"
|
||||
echo -e "${Red}Error${Color_Off} check_addons_exist.py into install_addons.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -21,6 +24,6 @@ fi
|
|||
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error run.sh into install_addons.sh"
|
||||
echo -e "${Red}Error${Color_Off} run.sh into install_addons.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,21 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# "$1" module_name
|
||||
# "$1" code_generator_template_name
|
||||
./script/database/db_restore.py --database "$2"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/database/db_restore.py into install_addons_cg_template_restore_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/database/db_restore.py into install_addons_cg_template_restore_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
./script/addons/install_addons_dev.sh "$2" "$1"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/addons/install_addons_dev.sh install module into install_addons_cg_template_restore_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/addons/install_addons_dev.sh install module into install_addons_cg_template_restore_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
./script/addons/install_addons_dev.sh "$2" "$2"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/addons/install_addons_dev.sh install template into install_addons_cg_template_restore_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/addons/install_addons_dev.sh install template into install_addons_cg_template_restore_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# Argument 3 is config
|
||||
if [[ $# -eq 3 ]]; then
|
||||
./script/addons/check_addons_exist.py -m "$2" -c "$3"
|
||||
|
|
@ -7,7 +10,7 @@ else
|
|||
fi
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error check_addons_exist.py into install_addons_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} check_addons_exist.py into install_addons_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -22,6 +25,6 @@ fi
|
|||
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error run.sh into install_addons_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} run.sh into install_addons_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# $1 BD NAME
|
||||
# $2 file_path
|
||||
./script/addons/install_addons.sh "$1" "$(<$2)"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/addons/install_addons.sh into install_addons_from_file.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/addons/install_addons.sh into install_addons_from_file.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# "$1" code_generator_name
|
||||
./script/database/db_restore.py --database "$1"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/database/db_restore.py into install_addons_restore_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/database/db_restore.py into install_addons_restore_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./script/addons/install_addons_dev.sh "$1" "$1"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/addons/install_addons_dev.sh into install_addons_restore_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/addons/install_addons_dev.sh into install_addons_restore_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
# TODO addons website need to be install before to install the theme
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# Argument 3 is config
|
||||
if [[ $# -eq 3 ]]; then
|
||||
./script/addons/check_addons_exist.py -m "$2" -c "$3"
|
||||
|
|
@ -8,7 +11,7 @@ else
|
|||
fi
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error check_addons_exist.py into install_addons.sh"
|
||||
echo -e "${Red}Error${Color_Off} check_addons_exist.py into install_addons.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -22,6 +25,6 @@ fi
|
|||
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error run.sh into install_addons_theme.sh"
|
||||
echo -e "${Red}Error${Color_Off} run.sh into install_addons_theme.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# Argument 3 is config
|
||||
if [[ $# -eq 3 ]]; then
|
||||
./script/addons/check_addons_exist.py -m "$2" -c "$3"
|
||||
|
|
@ -7,7 +10,7 @@ else
|
|||
fi
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error check_addons_exist.py into reinstall_addons_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} check_addons_exist.py into reinstall_addons_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -28,6 +31,6 @@ else
|
|||
fi
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error install_addons_dev.sh into reinstall_addons.sh"
|
||||
echo -e "${Red}Error${Color_Off} install_addons_dev.sh into reinstall_addons.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# Argument 3 is config
|
||||
if [[ $# -eq 3 ]]; then
|
||||
./script/addons/check_addons_exist.py -m "$2" -c "$3"
|
||||
|
|
@ -7,7 +10,7 @@ else
|
|||
fi
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error check_addons_exist.py into uninstall_addons.sh"
|
||||
echo -e "${Red}Error${Color_Off} check_addons_exist.py into uninstall_addons.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
echo "Update all on BD '$1'"
|
||||
|
||||
|
|
@ -6,6 +8,6 @@ echo "Update all on BD '$1'"
|
|||
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error run.sh into update_addons_all.sh"
|
||||
echo -e "${Red}Error${Color_Off} run.sh into update_addons_all.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# This script will remove mail configuration, remove backup configuration, and force admin user to test/test
|
||||
echo "Update prod to dev on BD '$1'"
|
||||
|
||||
|
|
@ -6,6 +9,6 @@ echo "Update prod to dev on BD '$1'"
|
|||
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error install_addons.sh into update_prod_to_dev.sh"
|
||||
echo -e "${Red}Error${Color_Off} install_addons.sh into update_prod_to_dev.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -84,15 +84,15 @@ check_git() {
|
|||
fi
|
||||
if [ -z "$output" ]; then
|
||||
if [ $# -gt 1 ]; then
|
||||
echo "PASS - ${REP}/${2}"
|
||||
echo -e "${Green}PASS${Color_Off} - ${REP}/${2}"
|
||||
else
|
||||
echo "PASS - ${REP}"
|
||||
echo -e "${Green}PASS${Color_Off} - ${REP}"
|
||||
fi
|
||||
else
|
||||
if [ $# -gt 1 ]; then
|
||||
echo -e "${Red}FAIL - ${REP}${2}${Color_Off}"
|
||||
echo -e "${Red}FAIL${Color_Off} - ${REP}${2}"
|
||||
else
|
||||
echo -e "${Red}FAIL - ${REP}${Color_Off}"
|
||||
echo -e "${Red}FAIL${Color_Off} - ${REP}"
|
||||
fi
|
||||
echo -e "${BRed}${output}${Color_Off}"
|
||||
cd - >/dev/null || exit
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
# $3 is directory path to check
|
||||
# $4 is generated module name separate by ,
|
||||
# $5 optional, the config path
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
if [[ $# -lt 4 ]]; then
|
||||
echo "ERROR, need 4 arguments: 1-database name, 2-list of module to install, 3-directory to check difference, 4-list of generated module"
|
||||
echo -e "${Red}Error${Color_Off}, need 4 arguments: 1-database name, 2-list of module to install, 3-directory to check difference, 4-list of generated module"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -16,14 +18,14 @@ if [[ $# -eq 5 ]]; then
|
|||
./script/addons/coverage_install_addons_dev.sh "$1" "$2" "$5"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/addons/coverage_install_addons_dev.sh ${1} ${2} ${5}"
|
||||
echo -e "${Red}Error${Color_Off} ./script/addons/coverage_install_addons_dev.sh ${1} ${2} ${5}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
./script/addons/coverage_install_addons_dev.sh "$1" "$2"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/addons/coverage_install_addons_dev.sh ${1} ${2}"
|
||||
echo -e "${Red}Error${Color_Off} ./script/addons/coverage_install_addons_dev.sh ${1} ${2}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
@ -32,7 +34,7 @@ fi
|
|||
./script/code_generator/test_code_generator_update_module.py -m "$4" -d "$3" --datetime "${INIT_DATETIME}"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/code_generator/test_code_generator_update_module.py ${4} ${3}"
|
||||
echo -e "${Red}Error${Color_Off} ./script/code_generator/test_code_generator_update_module.py ${4} ${3}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -54,6 +56,6 @@ echo "TEST ${2}"
|
|||
./script/code_generator/check_git_change_code_generator.sh "$3"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/code_generator/check_git_change_code_generator.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/code_generator/check_git_change_code_generator.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
# $3 is directory path to check
|
||||
# $4 is generated module name separate by ,
|
||||
# $5 optional, the config path
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
if [[ $# -lt 4 ]]; then
|
||||
echo "ERROR, need 4 arguments: 1-database name, 2-list of module to install, 3-directory to check difference, 4-list of generated module"
|
||||
echo -e "${Red}Error${Color_Off}, need 4 arguments: 1-database name, 2-list of module to install, 3-directory to check difference, 4-list of generated module"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -16,14 +18,14 @@ if [[ $# -eq 5 ]]; then
|
|||
./script/addons/install_addons_dev.sh "$1" "$2" "$5"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/addons/install_addons_dev.sh ${1} ${2} ${5}"
|
||||
echo -e "${Red}Error${Color_Off} ./script/addons/install_addons_dev.sh ${1} ${2} ${5}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
./script/addons/install_addons_dev.sh "$1" "$2"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/addons/install_addons_dev.sh ${1} ${2}"
|
||||
echo -e "${Red}Error${Color_Off} ./script/addons/install_addons_dev.sh ${1} ${2}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
@ -32,7 +34,7 @@ fi
|
|||
./script/code_generator/test_code_generator_update_module.py -m "$4" -d "$3" --datetime "${INIT_DATETIME}"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/code_generator/test_code_generator_update_module.py ${4} ${3}"
|
||||
echo -e "${Red}Error${Color_Off} ./script/code_generator/test_code_generator_update_module.py ${4} ${3}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -64,6 +66,6 @@ echo "TEST ${2}"
|
|||
./script/code_generator/check_git_change_code_generator.sh "$3"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/code_generator/check_git_change_code_generator.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/code_generator/check_git_change_code_generator.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import argparse
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
from colorama import Fore, Style
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
|
@ -75,12 +76,12 @@ def main():
|
|||
|
||||
if lst_result_wrong:
|
||||
_logger.error(
|
||||
"FAIL - Some modules wasn't updated, did you execute the code"
|
||||
f" generator? {lst_result_wrong}"
|
||||
f"{Fore.RED}FAIL{Style.RESET_ALL} - Some modules wasn't updated,"
|
||||
f" did you execute the code generator? {lst_result_wrong}"
|
||||
)
|
||||
return -1
|
||||
elif lst_result_good:
|
||||
_logger.info("SUCCESS - All modules are updated.")
|
||||
_logger.info(f"{Fore.GREEN}SUCCESS{Style.RESET_ALL} - All modules are updated.")
|
||||
|
||||
return 0
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import logging
|
|||
import os
|
||||
import sys
|
||||
from xml.dom import Node, minidom
|
||||
from colorama import Fore, Style
|
||||
|
||||
from code_writer import CodeWriter
|
||||
|
||||
|
|
@ -109,7 +110,7 @@ def main():
|
|||
|
||||
mydoc = minidom.parse(config.file)
|
||||
if not mydoc:
|
||||
print(f"Error, cannot parse {config.file}")
|
||||
print(f"{Fore.RED}Error{Style.RESET_ALL}, cannot parse {config.file}")
|
||||
sys.exit(1)
|
||||
|
||||
cw.emit("from lxml.builder import E")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
. ./env_var.sh
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
ARGS=""
|
||||
IS_RELEASE=false
|
||||
|
|
@ -50,7 +52,7 @@ echo "Create docker ${ERPLIBRE_DOCKER_PROD_VERSION}"
|
|||
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/docker/docker_build.sh when execute docker_update_version.py"
|
||||
echo -e "${Red}Error${Color_Off} ./script/docker/docker_build.sh when execute docker_update_version.py"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from __future__ import print_function
|
|||
import argparse
|
||||
import os.path
|
||||
import shutil
|
||||
from colorama import Fore, Style
|
||||
|
||||
import yaml # pip install PyYAML
|
||||
from agithub.GitHub import GitHub # pip install agithub
|
||||
|
|
@ -169,7 +170,10 @@ def fork_and_clone_repo(
|
|||
parsed_url.repo
|
||||
].forks.post(**args)
|
||||
if status == 404:
|
||||
print("Error when forking repo %s" % forked_repo)
|
||||
print(
|
||||
f"{Fore.RED}FAIL{Style.RESET_ALL} when forking repo"
|
||||
f" {forked_repo}"
|
||||
)
|
||||
exit(1)
|
||||
else:
|
||||
print("Forked %s to %s" % (upstream_url, forked_repo["html_url"]))
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import argparse
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
from colorama import Fore, Style
|
||||
|
||||
from git import Repo
|
||||
|
||||
|
|
@ -91,8 +92,8 @@ def main():
|
|||
path2 = value2.get("@path")
|
||||
if path1 != path2:
|
||||
print(
|
||||
f"WARNING id {i}, path of git are different. "
|
||||
f"Input1 {path1}, input2 {path2}"
|
||||
f"{Fore.YELLOW}WARNING{Style.RESET_ALL} id {i}, path of git"
|
||||
f" are different. Input1 {path1}, input2 {path2}"
|
||||
)
|
||||
continue
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import os
|
|||
import webbrowser
|
||||
from collections import OrderedDict
|
||||
from typing import List
|
||||
from colorama import Fore, Style
|
||||
|
||||
import git
|
||||
import xmltodict
|
||||
|
|
@ -307,9 +308,10 @@ class GitTool:
|
|||
url = repo_root.git.remote("get-url", "origin")
|
||||
except Exception as e:
|
||||
print(
|
||||
"WARNING: Missing origin remote, use default url "
|
||||
f"{DEFAULT_REMOTE_URL}. Suggest to add a remote origin: \n"
|
||||
f"> git remote add origin {DEFAULT_REMOTE_URL}"
|
||||
f"{Fore.YELLOW}WARNING{Style.RESET_ALL}: Missing origin"
|
||||
f" remote, use default url {DEFAULT_REMOTE_URL}. Suggest"
|
||||
" to add a remote origin: \n> git remote add origin"
|
||||
f" {DEFAULT_REMOTE_URL}"
|
||||
)
|
||||
url = DEFAULT_REMOTE_URL
|
||||
url, url_https, url_git = self.get_url(url)
|
||||
|
|
@ -694,7 +696,10 @@ class GitTool:
|
|||
continue
|
||||
line_split = line.split(",")
|
||||
if len(line_split) != 4:
|
||||
print(f"Error with line {line}, suppose to have only 4 ','.")
|
||||
print(
|
||||
f"{Fore.RED}Error{Style.RESET_ALL} with line {line},"
|
||||
" suppose to have only 4 ','."
|
||||
)
|
||||
exit(1)
|
||||
url, path, revision, clone_depth = line_split
|
||||
# Validate url
|
||||
|
|
@ -962,7 +967,10 @@ class GitTool:
|
|||
parsed_url.repo
|
||||
].forks.post(**args)
|
||||
if status == 404:
|
||||
print("Error when forking repo %s" % forked_repo)
|
||||
print(
|
||||
f"{Fore.RED}Error{Style.RESET_ALL} when forking repo"
|
||||
f" {forked_repo}"
|
||||
)
|
||||
exit(1)
|
||||
else:
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ EL_HOME_ODOO="${EL_HOME}/odoo"
|
|||
#EL_MINIMAL_ADDONS="False"
|
||||
#EL_INSTALL_NGINX="True"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
./script/generate_config.sh
|
||||
|
||||
#echo -e "\n---- Install Odoo with addons module ----"
|
||||
|
|
@ -57,7 +60,7 @@ if [[ ! -d "${PYENV_VERSION_PATH}" ]]; then
|
|||
echo -e "\n---- Installing python ${PYTHON_VERSION} with pyenv in ${PYENV_VERSION_PATH} ----"
|
||||
yes n|pyenv install ${PYTHON_VERSION}
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error when installing pyenv"
|
||||
echo -e "${Red}Error${Color_Off} when installing pyenv"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@
|
|||
|
||||
. ./env_var.sh
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
./script/install/install_locally.sh
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/install/install_locally.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/install/install_locally.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -13,7 +16,7 @@ fi
|
|||
./script/manifest/update_manifest_local_dev.sh
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error manifest update, check git-repo."
|
||||
echo -e "${Red}Error${Color_Off} manifest update, check git-repo."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@
|
|||
|
||||
. ./env_var.sh
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
./script/install/install_locally.sh
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/install/install_locally.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/install/install_locally.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -13,6 +16,6 @@ fi
|
|||
./script/manifest/update_manifest_prod.sh
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error manifest update, check git-repo."
|
||||
echo -e "${Red}Error${Color_Off} manifest update, check git-repo."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# This will format all python file
|
||||
# argument 1: directory or file to format
|
||||
NPROC=$(nproc)
|
||||
|
|
@ -6,6 +9,6 @@ source ./script/OCA_maintainer-tools/env/bin/activate
|
|||
oca-autopep8 -j ${NPROC} --max-line-length 79 -ari $@
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error oca-autopep8 format"
|
||||
echo -e "${Red}Error${Color_Off} oca-autopep8 format"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# This will format all python file
|
||||
# argument 1: directory or file to format
|
||||
source ./.venv/bin/activate
|
||||
black -l 79 --preview -t py37 "$@"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error black format"
|
||||
echo -e "${Red}Error${Color_Off} black format"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# This will format all js,css,html
|
||||
# argument 1: directory or file to format
|
||||
./node_modules/.bin/prettier --tab-width 4 --print-width 120 --no-bracket-spacing --write "$@"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error prettier format"
|
||||
echo -e "${Red}Error${Color_Off} prettier format"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# This will format all xml
|
||||
# argument 1: directory or file to format
|
||||
STR_ARG="'$*'"
|
||||
|
|
@ -12,6 +15,6 @@ else
|
|||
fi
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error prettier-xml format"
|
||||
echo -e "${Red}Error${Color_Off} prettier-xml format"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
echo "
|
||||
===> ${@}
|
||||
"
|
||||
|
|
@ -10,6 +13,6 @@ echo "
|
|||
"
|
||||
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error make ${@}"
|
||||
echo -e "${Red}Error${Color_Off} make ${@}"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
./.venv/bin/poetry add -vv $(grep -v ";" ./.venv/build_dependency.txt | grep -v "*" )
|
||||
# poetry add -vv $(grep -v ";" ./.venv/build_dependency.txt | grep -v "*" | sed 's/==/@^/' )
|
||||
# poetry export -f ./.venv/build_dependency.txt --dev | poetry run -- pip install -r /dev/stdin
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error ./script/poetry/poetry_add_build_dependency.sh"
|
||||
echo -e "${Red}Error${Color_Off} ./script/poetry/poetry_add_build_dependency.sh"
|
||||
cat ./.venv/build_dependency.txt
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import argparse
|
|||
import ast
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from collections import OrderedDict, defaultdict
|
||||
from pathlib import Path
|
||||
from colorama import Fore, Style
|
||||
|
||||
import iscompatible
|
||||
import toml
|
||||
|
|
@ -267,8 +267,8 @@ def combine_requirements(config):
|
|||
]
|
||||
)
|
||||
print(
|
||||
f"WARNING - Not compatible {str_versions} - "
|
||||
f"{str_result_choose}."
|
||||
f"{Fore.YELLOW}WARNING{Style.RESET_ALL} - Not"
|
||||
f" compatible {str_versions} - {str_result_choose}."
|
||||
)
|
||||
elif len(lst_version_requirement) == 1:
|
||||
result = lst_version_requirement[0][0]
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from collections import defaultdict
|
|||
|
||||
import aioshutil
|
||||
import git
|
||||
from colorama import Fore
|
||||
from colorama import Fore, Style
|
||||
|
||||
new_path = os.path.normpath(
|
||||
os.path.join(os.path.dirname(__file__), "..", "..")
|
||||
|
|
@ -150,14 +150,14 @@ def check_result(task_list, tpl_result):
|
|||
status = False
|
||||
|
||||
if lst_warning:
|
||||
print(f"{Fore.YELLOW}{len(lst_warning)} WARNING{Fore.RESET}")
|
||||
print(f"{Fore.YELLOW}{len(lst_warning)} WARNING{Style.RESET_ALL}")
|
||||
i = 0
|
||||
for warning in lst_warning:
|
||||
i += 1
|
||||
print(f"[{i}]{warning}")
|
||||
|
||||
if lst_error:
|
||||
print(f"{Fore.RED}{len(lst_error)} ERROR{Fore.RESET}")
|
||||
print(f"{Fore.RED}{len(lst_error)} ERROR{Style.RESET_ALL}")
|
||||
i = 0
|
||||
for error in lst_error:
|
||||
i += 1
|
||||
|
|
@ -165,13 +165,13 @@ def check_result(task_list, tpl_result):
|
|||
|
||||
if lst_error or lst_warning:
|
||||
str_result = (
|
||||
f"{Fore.RED}{len(lst_error)} ERROR"
|
||||
f" {Fore.YELLOW}{len(lst_warning)} WARNING"
|
||||
f"{Fore.RED}{len(lst_error)} ERROR{Style.RESET_ALL}"
|
||||
f" {Fore.YELLOW}{len(lst_warning)} WARNING{Style.RESET_ALL}"
|
||||
)
|
||||
else:
|
||||
str_result = f"{Fore.GREEN}SUCCESS 🍰"
|
||||
str_result = f"{Fore.GREEN}SUCCESS{Style.RESET_ALL} 🍰"
|
||||
|
||||
print(f"{Fore.BLUE}Summary TEST {str_result}{Fore.RESET}")
|
||||
print(f"{Fore.BLUE}Summary TEST {str_result}{Style.RESET_ALL}")
|
||||
return status
|
||||
|
||||
|
||||
|
|
@ -182,7 +182,11 @@ def print_log(lst_task, tpl_result):
|
|||
with open(LOG_FILE, "w") as f:
|
||||
for i, task in enumerate(lst_task):
|
||||
result = tpl_result[i]
|
||||
status_str = "PASS" if not result[1] else "FAIL"
|
||||
status_str = (
|
||||
f"{Fore.GREEN}PASS{Style.RESET_ALL}"
|
||||
if not result[1]
|
||||
else f"{Fore.RED}FAIL{Style.RESET_ALL}"
|
||||
)
|
||||
f.write(
|
||||
f"\nTest execution {i + 1} - {status_str} -"
|
||||
f" {task.cr_code.co_name}\n\n"
|
||||
|
|
@ -206,7 +210,11 @@ def print_log_output_into_dir(tpl_result, output_dir):
|
|||
f.write(f"{test_name}\n")
|
||||
f.write(f"{time_execution}\n")
|
||||
f.write(f"{date_now}\n")
|
||||
status_str = "PASS" if not status else "FAIL"
|
||||
status_str = (
|
||||
f"{Fore.GREEN}PASS{Style.RESET_ALL}"
|
||||
if not status
|
||||
else f"{Fore.RED}FAIL{Style.RESET_ALL}"
|
||||
)
|
||||
f.write(
|
||||
f"\nTest execution {i + 1} - {status_str} - {test_name}\n\n"
|
||||
)
|
||||
|
|
@ -232,7 +240,11 @@ async def run_command(*args, test_name=None):
|
|||
# Return stdout + stderr, returncode
|
||||
str_out = "\n" + stdout.decode().strip() + "\n" if stdout else ""
|
||||
str_err = "\n" + stderr.decode().strip() + "\n" if stderr else ""
|
||||
status_str = "FAIL" if process.returncode else "PASS"
|
||||
status_str = (
|
||||
f"{Fore.RED}FAIL{Style.RESET_ALL}"
|
||||
if process.returncode
|
||||
else f"{Fore.GREEN}PASS{Style.RESET_ALL}"
|
||||
)
|
||||
if test_name:
|
||||
str_output_init = (
|
||||
f"\n\n{status_str} [{test_name}] [{diff_sec:.3f}s] Execute"
|
||||
|
|
@ -356,8 +368,8 @@ async def test_exec(
|
|||
if not os.path.exists(path_module_check):
|
||||
# TODO wrong return
|
||||
return (
|
||||
f"Error var path_module_check '{path_module_check}' not"
|
||||
" exist.",
|
||||
f"{Fore.RED}Error{Style.RESET_ALL} var path_module_check"
|
||||
f" '{path_module_check}' not exist.",
|
||||
-1,
|
||||
)
|
||||
|
||||
|
|
@ -413,8 +425,8 @@ async def test_exec(
|
|||
if not s_lst_path_tested_module:
|
||||
# TODO wrong return
|
||||
return (
|
||||
f"Error cannot find module '{path_module_check}' not"
|
||||
" exist.",
|
||||
f"{Fore.RED}Error{Style.RESET_ALL} cannot find module"
|
||||
f" '{path_module_check}' not exist.",
|
||||
-1,
|
||||
)
|
||||
else:
|
||||
|
|
@ -738,7 +750,8 @@ async def test_exec(
|
|||
else:
|
||||
test_status += 1
|
||||
test_result += (
|
||||
f"\n\nFAIL - inspect to delete file {lst_file_to_ignore}"
|
||||
f"\n\n{Fore.RED}FAIL{Style.RESET_ALL} - inspect to delete file"
|
||||
f" {lst_file_to_ignore}"
|
||||
)
|
||||
|
||||
delta = datetime.datetime.now() - time_init
|
||||
|
|
@ -893,7 +906,7 @@ def run_all_test(config) -> bool:
|
|||
if status:
|
||||
log_file_print = LOG_FILE
|
||||
else:
|
||||
log_file_print = f"{Fore.RED}{LOG_FILE}{Fore.RESET}"
|
||||
log_file_print = f"{Fore.RED}{LOG_FILE}{Style.RESET_ALL}"
|
||||
|
||||
if config.output_result_dir:
|
||||
print_log_output_into_dir(total_tpl_result, config.output_result_dir)
|
||||
|
|
|
|||
8
test.sh
8
test.sh
|
|
@ -1,20 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
# Usage, ./test.sh -d test_addons_name -i module_name
|
||||
source ./.venv/bin/activate
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
CONFIG_PATH="./config.conf"
|
||||
ORIGIN_CONFIG_PATH=CONFIG_PATH
|
||||
if [ ! -f "${CONFIG_PATH}" ]; then
|
||||
CONFIG_PATH="/etc/odoo/odoo.conf"
|
||||
if [ ! -f "${CONFIG_PATH}" ]; then
|
||||
echo "Cannot find ERPLibre configuration ${ORIGIN_CONFIG_PATH}, did you install ERPLibre? > make install"
|
||||
echo "${Red}Cannot find${Color_Off} ERPLibre configuration ${ORIGIN_CONFIG_PATH}, did you install ERPLibre? > make install"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
coverage run -p ./odoo/odoo-bin -c ${CONFIG_PATH} --limit-time-real 99999 --limit-time-cpu 99999 --log-level=test --test-enable --stop-after-init $@
|
||||
coverage run -p ./odoo/odoo-bin -c "${CONFIG_PATH}" --limit-time-real 99999 --limit-time-cpu 99999 --log-level=test --test-enable --stop-after-init "$@"
|
||||
retVal=$?
|
||||
if [[ $retVal -ne 0 ]]; then
|
||||
echo "Error test.sh"
|
||||
echo "${Red}Error${Color_Off} run.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue