diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c4949fa..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: minimal - -services: - - docker - -script: - - docker build -f docker/Dockerfile.base -t technolibre/erplibre-base:12.0 docker/ -# - docker build -f docker/Dockerfile.dev -t technolibre/erplibre:12.0 docker/ - - docker build -f docker/Dockerfile.pkg -t technolibre/erplibre:12.0-pkg docker/ - -after_success: - - docker login --username mikefaille --password "${DOCKER_TOKEN}" - - docker push technolibre/erplibre-core:12.0 - - docker push technolibre/erplibre:12.0-pkg diff --git a/CHANGELOG.md b/CHANGELOG.md index f9bc266..c086e8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,8 @@ Do a backup of your database and update all module : - Support Ubuntu 22.04 with installation script - Module mail_history and fetchmail_thread_default in base image DB - Makefile can generate image DB in parallel with `image_db_create_all_parallel` +- Makefile can run all code_generator with `run_parallel_cg` and `run_parallel_cg_template` +- Script to generate Pycharm configuration and exclude directory ## Changed @@ -48,6 +50,7 @@ Do a backup of your database and update all module : - Update all repo (91) to end of 2022 - Rename module project_task_subtask_time_range => project_time_budget - Rename module project_task_time_range => project_time_range +- Refactor script emplacement, create directory in ./script/ per subject ### Fixed @@ -331,7 +334,7 @@ Because addons repository has change, config file need to be updated. - Improved documentation with development and production environment - Improved documentation with git repo - Move default.xml manifest to root, the default location -- Support default.stage.xml to update prod with dev +- Support default.staged.xml to update prod with dev - Feature to show diff between manifests or between repo of different manifests - Update manifest - Muk theme in erplibre_base diff --git a/Makefile b/Makefile index ec83a51..adae43b 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,14 @@ run_code_generator: # -$(BROWSER) http://localhost:8069 ./run.sh --database code_generator +.PHONY: run_parallel_cg +run_parallel_cg: + parallel < ./conf/list_cg_test.txt + +.PHONY: run_parallel_cg_template +run_parallel_cg_template: + parallel < ./conf/list_cg_template_test.txt + ############# # INSTALL # ############# @@ -63,25 +71,25 @@ install:install_os install_dev .PHONY: install_dev install_dev: - ./script/install_locally_dev.sh + ./script/install/install_locally_dev.sh # Install this for the first time of dev environment .PHONY: install_os install_os: - ./script/install_dev.sh + ./script/install/install_dev.sh .PHONY: install_production install_production: - ./script/install_dev.sh - ./script/install_production.sh + ./script/install/install_dev.sh + ./script/install/install_production.sh .PHONY: install_docker_debian install_docker_debian: - ./script/ install_debian_10_prod_docker.sh + ./script/install/install_debian_10_prod_docker.sh .PHONY: install_docker_ubuntu install_docker_ubuntu: - ./script/install_ubuntu_docker.sh + ./script/install/install_ubuntu_docker.sh ##################### # DB installation # @@ -128,54 +136,54 @@ db_drop_test: .PHONY: db_clean_cache db_clean_cache: - ./script/db_restore.py --clean_cache + ./script/database/db_restore.py --clean_cache .PHONY: db_restore_erplibre_base_db_test db_restore_erplibre_base_db_test: - ./script/db_restore.py --database test + ./script/database/db_restore.py --database test .PHONY: db_restore_erplibre_base_db_test_module_test db_restore_erplibre_base_db_test_module_test: - ./script/db_restore.py --database test + ./script/database/db_restore.py --database test ./script/addons/install_addons.sh test test .PHONY: db_restore_prod_client db_restore_prod_client: # You need to put the database backup in ./image_db/prod_client.zip - ./script/db_restore.py --database prod_client --image prod_client - ./script/migrate_prod_to_test.sh prod_client + ./script/database/db_restore.py --database prod_client --image prod_client + ./script/database/migrate_prod_to_test.sh prod_client .PHONY: db_restore_erplibre_base_db_test_image_test db_restore_erplibre_base_db_test_image_test: - ./script/db_restore.py --database test --image test + ./script/database/db_restore.py --database test --image test .PHONY: db_restore_erplibre_base_db_test2 db_restore_erplibre_base_db_test2: - ./script/db_restore.py --database test2 + ./script/database/db_restore.py --database test2 .PHONY: db_restore_erplibre_base_db_test3 db_restore_erplibre_base_db_test3: - ./script/db_restore.py --database test3 + ./script/database/db_restore.py --database test3 .PHONY: db_restore_erplibre_website_db_test db_restore_erplibre_website_db_test: - ./script/db_restore.py --database test --image erplibre_website + ./script/database/db_restore.py --database test --image erplibre_website .PHONY: db_restore_erplibre_website_chat_crm_db_test db_restore_erplibre_website_chat_crm_db_test: - ./script/db_restore.py --database test --image erplibre_website_chat_crm + ./script/database/db_restore.py --database test --image erplibre_website_chat_crm .PHONY: db_restore_erplibre_ecommerce_base_db_test db_restore_erplibre_ecommerce_base_db_test: - ./script/db_restore.py --database test --image erplibre_ecommerce_base + ./script/database/db_restore.py --database test --image erplibre_ecommerce_base .PHONY: db_restore_erplibre_base_db_code_generator db_restore_erplibre_base_db_code_generator: - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator .PHONY: db_restore_erplibre_base_db_template db_restore_erplibre_base_db_template: - ./script/db_restore.py --database template + ./script/database/db_restore.py --database template .PHONY: db_create_db_test db_create_db_test: @@ -377,7 +385,7 @@ image_db_create_erplibre_package_wiki: .PHONY: image_db_create_all image_db_create_all: #./script/make.sh config_gen_image_db - ./script/db_restore.py --clean_cache + ./script/database/db_restore.py --clean_cache ./script/make.sh image_db_create_erplibre_base ./script/make.sh image_db_create_erplibre_website ./script/make.sh image_db_create_erplibre_code_generator @@ -403,13 +411,13 @@ image_db_create_all: .PHONY: image_db_create_all_parallel image_db_create_all_parallel: - ./script/db_restore.py --clean_cache + ./script/database/db_restore.py --clean_cache ./script/make.sh image_db_create_erplibre_base parallel < ./conf/image_db_create.txt .PHONY: image_db_create_test_website_attachments image_db_create_test_website_attachments: - ./script/db_restore.py --database code_generator_test_website_attachements --image test_website_attachments + ./script/database/db_restore.py --database code_generator_test_website_attachements --image test_website_attachments # Do your stuff ./.venv/bin/python3 ./odoo/odoo-bin --limit-time-real 999999 --no-http -c config.conf --stop-after-init -d code_generator_test_website_attachements -u all ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database code_generator_test_website_attachements --restore_image test_website_attachments @@ -424,33 +432,33 @@ image_diff_base_website: ######################### .PHONY: addons_install_code_generator_basic addons_install_code_generator_basic: - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator ./script/addons/install_addons_dev.sh code_generator code_generator .PHONY: addons_install_code_generator_featured addons_install_code_generator_featured: - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator ./script/addons/install_addons_dev.sh code_generator code_generator_cron,code_generator_hook,code_generator_portal .PHONY: addons_install_code_generator_full addons_install_code_generator_full: - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator ./script/addons/install_addons_dev.sh code_generator code_generator_cron,code_generator_hook,code_generator_portal,code_generator_db_servers,code_generator_website_snippet,code_generator_geoengine,code_generator_theme_website,code_generator_website_leaflet .PHONY: addons_install_code_generator_demo addons_install_code_generator_demo: - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator ./script/addons/install_addons_dev.sh code_generator code_generator_demo .PHONY: addons_install_all_code_generator_demo addons_install_all_code_generator_demo: - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator # TODO ignore code_generator_demo_internal cause (demo_internal, demo_model_2_internal_view_form) already exists ./script/addons/install_addons_dev.sh code_generator code_generator_demo,code_generator_demo_export_helpdesk,code_generator_demo_export_website,code_generator_demo_internal_inherit,code_generator_demo_portal,code_generator_demo_theme_website,code_generator_demo_website_leaflet,code_generator_demo_website_snippet,code_generator_auto_backup # Conflict between code_generator_demo_website_multiple_snippet and code_generator_demo_internal_inherit - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator ./script/addons/install_addons_dev.sh code_generator code_generator_demo_website_multiple_snippet - ./script/db_restore.py --database code_generator_test_website_attachements --image test_website_attachments + ./script/database/db_restore.py --database code_generator_test_website_attachements --image test_website_attachments ./script/addons/install_addons_dev.sh code_generator_test_website_attachements code_generator_demo_export_website_attachments #./script/addons/install_addons_dev.sh code_generator code_generator_demo @@ -467,7 +475,7 @@ addons_install_all_code_generator_demo: .PHONY: addons_install_all_code_generator_template addons_install_all_code_generator_template: - ./script/db_restore.py --database template + ./script/database/db_restore.py --database template ./script/addons/install_addons_dev.sh template demo_portal,auto_backup,demo_internal_inherit ./script/addons/install_addons_dev.sh template code_generator_template_demo_portal,code_generator_template_demo_sysadmin_cron,code_generator_template_demo_internal_inherit @@ -499,7 +507,7 @@ addons_install_all_code_generator_template: .PHONY: addons_install_all_generated_demo addons_install_all_generated_demo: - ./script/db_restore.py --database template + ./script/database/db_restore.py --database template ./script/addons/install_addons_dev.sh template demo_helpdesk_data,demo_website_data,demo_internal,demo_internal_inherit,demo_portal,demo_website_leaflet,demo_website_snippet,auto_backup ./script/addons/install_addons_theme.sh template theme_website_demo_code_generator #./script/addons/install_addons_dev.sh template demo_helpdesk_data @@ -517,7 +525,7 @@ addons_install_all_generated_demo: ################## .PHONY: addons_install_code_generator_template_code_generator addons_install_code_generator_template_code_generator: - ./script/db_restore.py --database template + ./script/database/db_restore.py --database template ./script/code_generator/search_class_model.py --quiet -d addons/TechnoLibre_odoo-code-generator/code_generator -t addons/TechnoLibre_odoo-code-generator-template/code_generator_template_code_generator --with_inherit ./script/maintenance/black.sh ./addons/TechnoLibre_odoo-code-generator-template/code_generator_template_code_generator ./script/addons/install_addons_dev.sh template code_generator @@ -526,7 +534,7 @@ addons_install_code_generator_template_code_generator: .PHONY: addons_install_code_generator_code_generator addons_install_code_generator_code_generator: - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator ./script/addons/install_addons_dev.sh code_generator code_generator_code_generator ./script/git/remote_code_generation_git_compare.py --quiet --git_gui --clear --replace_directory --directory1 ./addons/TechnoLibre_odoo-code-generator/code_generator --directory2 ./addons/TechnoLibre_odoo-code-generator-template/code_generator @@ -546,16 +554,16 @@ meld_code_generator_code_generator: .PHONY: addons_install_code_generator_mariadb_sql_example_1 addons_install_code_generator_mariadb_sql_example_1: ./script/database/restore_mariadb_sql_example_1.sh - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator ./script/addons/install_addons_dev.sh code_generator code_generator_portal ./script/addons/install_addons_dev.sh code_generator code_generator_migrator_demo_mariadb_sql_example_1 - ./script/db_restore.py --database template + ./script/database/db_restore.py --database template ./script/addons/install_addons_dev.sh template code_generator_portal,demo_mariadb_sql_example_1 ./script/code_generator/search_class_model.py --quiet -d addons/TechnoLibre_odoo-code-generator-template/demo_mariadb_sql_example_1 -t addons/TechnoLibre_odoo-code-generator-template/code_generator_template_demo_mariadb_sql_example_1 ./script/addons/install_addons_dev.sh template code_generator_template_demo_mariadb_sql_example_1 - ./script/db_restore.py --database code_generator + ./script/database/db_restore.py --database code_generator ./script/addons/install_addons_dev.sh code_generator code_generator_portal ./script/addons/install_addons_dev.sh code_generator code_generator_demo_mariadb_sql_example_1 @@ -623,7 +631,7 @@ test_code_generator_hello_world: .PHONY: test_installation_demo test_installation_demo: ./script/code_generator/check_git_change_code_generator.sh ./addons/TechnoLibre_odoo-code-generator-template - ./script/db_restore.py --database test_demo + ./script/database/db_restore.py --database test_demo ./script/addons/install_addons.sh test_demo demo_helpdesk_data,demo_internal,demo_internal_inherit,demo_mariadb_sql_example_1,demo_portal,demo_website_data,demo_website_leaflet,demo_website_snippet ./script/addons/install_addons_theme.sh test_demo theme_website_demo_code_generator @@ -632,18 +640,18 @@ test_code_generator_generation: ./script/code_generator/check_git_change_code_generator.sh ./addons/TechnoLibre_odoo-code-generator-template ./script/code_generator/check_git_change_code_generator.sh ./addons/OCA_server-tools/auto_backup # Multiple - ./script/db_restore.py --database test_code_generator + ./script/database/db_restore.py --database test_code_generator ./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo,code_generator_demo_export_helpdesk,code_generator_demo_export_website,code_generator_demo_internal,code_generator_demo_portal,code_generator_demo_theme_website,code_generator_demo_website_leaflet,code_generator_demo_website_snippet ./addons/TechnoLibre_odoo-code-generator-template code_generator_demo,demo_helpdesk_data,demo_website_data,demo_internal,demo_portal,theme_website_demo_code_generator,demo_website_leaflet,demo_website_snippet # inherit # TODO should be in multiple list, need to support it - ./script/db_restore.py --database test_code_generator + ./script/database/db_restore.py --database test_code_generator ./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo_internal_inherit ./addons/TechnoLibre_odoo-code-generator-template demo_internal_inherit # auto_backup - ./script/db_restore.py --database test_code_generator + ./script/database/db_restore.py --database test_code_generator ./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_auto_backup ./addons/OCA_server-tools/auto_backup auto_backup # Single - #./script/db_restore.py --database test_code_generator + #./script/database/db_restore.py --database test_code_generator #./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo ./addons/TechnoLibre_odoo-code-generator-template code_generator_demo #./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo_export_helpdesk ./addons/TechnoLibre_odoo-code-generator-template demo_helpdesk_data #./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo_export_website ./addons/TechnoLibre_odoo-code-generator-template demo_website_data @@ -652,9 +660,9 @@ test_code_generator_generation: #./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo_theme_website ./addons/TechnoLibre_odoo-code-generator-template theme_website_demo_code_generator #./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo_website_leaflet ./addons/TechnoLibre_odoo-code-generator-template demo_website_leaflet #./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo_website_snippet ./addons/TechnoLibre_odoo-code-generator-template demo_website_snippet - #./script/db_restore.py --database test_code_generator + #./script/database/db_restore.py --database test_code_generator #./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo_internal_inherit ./addons/TechnoLibre_odoo-code-generator-template demo_internal_inherit - #./script/db_restore.py --database test_code_generator + #./script/database/db_restore.py --database test_code_generator #./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_auto_backup ./addons/OCA_server-tools/auto_backup auto_backup .PHONY: test_code_generator_generation_template @@ -666,7 +674,7 @@ test_code_generator_generation_template: .PHONY: test_code_generator_code_template_demo_portal test_code_generator_code_template_demo_portal: ./script/code_generator/check_git_change_code_generator.sh ./addons/TechnoLibre_odoo-code-generator-template - ./script/db_restore.py --database test_template + ./script/database/db_restore.py --database test_template ./script/addons/install_addons_dev.sh test_template demo_portal #./script/addons/install_addons_dev.sh test_template code_generator_template_demo_portal ./script/code_generator/search_class_model.py --quiet -d addons/TechnoLibre_odoo-code-generator-template/demo_portal -t addons/TechnoLibre_odoo-code-generator-template/code_generator_template_demo_portal --with_inherit @@ -675,7 +683,7 @@ test_code_generator_code_template_demo_portal: .PHONY: test_code_generator_code_template_demo_internal_inherit test_code_generator_code_template_demo_internal_inherit: ./script/code_generator/check_git_change_code_generator.sh ./addons/TechnoLibre_odoo-code-generator-template - ./script/db_restore.py --database test_template + ./script/database/db_restore.py --database test_template ./script/addons/install_addons_dev.sh test_template demo_internal_inherit #./script/addons/install_addons_dev.sh test_template code_generator_template_demo_internal_inherit ./script/code_generator/search_class_model.py --quiet -d addons/TechnoLibre_odoo-code-generator-template/demo_internal_inherit -t addons/TechnoLibre_odoo-code-generator-template/code_generator_template_demo_internal_inherit --with_inherit @@ -684,7 +692,7 @@ test_code_generator_code_template_demo_internal_inherit: .PHONY: test_code_generator_code_template_demo_sysadmin_cron test_code_generator_code_template_demo_sysadmin_cron: ./script/code_generator/check_git_change_code_generator.sh ./addons/OCA_server-tools/auto_backup - ./script/db_restore.py --database test_template + ./script/database/db_restore.py --database test_template ./script/addons/install_addons_dev.sh test_template auto_backup #./script/addons/install_addons_dev.sh test_template code_generator_template_demo_sysadmin_cron ./script/code_generator/search_class_model.py --quiet -d addons/OCA_server-tools/auto_backup -t addons/TechnoLibre_odoo-code-generator-template/code_generator_template_demo_sysadmin_cron --with_inherit @@ -694,7 +702,7 @@ test_code_generator_code_template_demo_sysadmin_cron: test_code_generator_migrator_demo_mariadb_sql_example_1: ./script/code_generator/check_git_change_code_generator.sh ./addons/TechnoLibre_odoo-code-generator-template ./script/database/restore_mariadb_sql_example_1.sh - ./script/db_restore.py --database test_code_generator + ./script/database/db_restore.py --database test_code_generator ./script/addons/install_addons_dev.sh test_code_generator code_generator_portal #./script/addons/install_addons_dev.sh test_code_generator code_generator_migrator_demo_mariadb_sql_example_1 ./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_migrator_demo_mariadb_sql_example_1 ./addons/TechnoLibre_odoo-code-generator-template demo_mariadb_sql_example_1 @@ -702,7 +710,7 @@ test_code_generator_migrator_demo_mariadb_sql_example_1: .PHONY: test_code_generator_template_demo_mariadb_sql_example_1 test_code_generator_template_demo_mariadb_sql_example_1: ./script/code_generator/check_git_change_code_generator.sh ./addons/TechnoLibre_odoo-code-generator-template - ./script/db_restore.py --database test_template + ./script/database/db_restore.py --database test_template ./script/addons/install_addons_dev.sh test_template code_generator_portal,demo_mariadb_sql_example_1 ./script/code_generator/search_class_model.py --quiet -d addons/TechnoLibre_odoo-code-generator-template/demo_mariadb_sql_example_1 -t addons/TechnoLibre_odoo-code-generator-template/code_generator_template_demo_mariadb_sql_example_1 --with_inherit #./script/addons/install_addons_dev.sh test_template code_generator_template_demo_mariadb_sql_example_1 @@ -711,7 +719,7 @@ test_code_generator_template_demo_mariadb_sql_example_1: .PHONY: test_code_generator_demo_mariadb_sql_example_1 test_code_generator_demo_mariadb_sql_example_1: ./script/code_generator/check_git_change_code_generator.sh ./addons/TechnoLibre_odoo-code-generator-template - ./script/db_restore.py --database test_code_generator + ./script/database/db_restore.py --database test_code_generator ./script/addons/install_addons_dev.sh test_code_generator code_generator_portal #./script/addons/install_addons_dev.sh test_code_generator code_generator_demo_mariadb_sql_example_1 ./script/code_generator/install_and_test_code_generator.sh test_code_generator code_generator_demo_mariadb_sql_example_1 ./addons/TechnoLibre_odoo-code-generator-template demo_mariadb_sql_example_1 @@ -752,7 +760,7 @@ test_addons_code_generator: test_addons_code_generator_code_generator: # TODO this test only generation, not test ./.venv/bin/coverage erase - ./script/db_restore.py --database test_addons_code_generator_code_generator + ./script/database/db_restore.py --database test_addons_code_generator_code_generator ./test.sh --dev all -d test_addons_code_generator_code_generator --db-filter test_addons_code_generator_code_generator -i code_generator_code_generator ./.venv/bin/coverage combine -a ./.venv/bin/coverage report -m --include="addons/TechnoLibre_odoo-code-generator/*" @@ -770,7 +778,7 @@ open_test_coverage: ######### .PHONY: tag_push_all tag_push_all: - ./script/tag_push_all.py + ./script/git/tag_push_all.py ############## # terminal # @@ -838,7 +846,7 @@ log_show_test: ########### .PHONY: clean_code_generator_template clean_code_generator_template: - ./script/repo_revert_git_diff_date_from_code_generator.py + ./script/git/repo_revert_git_diff_date_from_code_generator.py .PHONY: clean_test clean_test: @@ -914,17 +922,17 @@ docker_clean_all: # clear all repo DANGER .PHONY: repo_clear_all repo_clear_all: - ./script/clean_repo_manifest.sh + ./script/git/clean_repo_manifest.sh # configure all repo .PHONY: repo_configure_all repo_configure_all: - ./script/update_manifest_local_dev.sh + ./script/manifest/update_manifest_local_dev.sh # configure only group code_generator .PHONY: repo_configure_group_code_generator repo_configure_group_code_generator: - ./script/update_manifest_local_dev_code_generator.sh + ./script/manifest/update_manifest_local_dev_code_generator.sh # Show git status for all repo .PHONY: repo_show_status @@ -934,27 +942,27 @@ repo_show_status: # Show divergence between actual repository and production manifest .PHONY: repo_diff_manifest_production repo_diff_manifest_production: - ./script/git_show_code_diff_repo_manifest.py + ./script/git/git_show_code_diff_repo_manifest.py # Show git diff for all repo from last tag version release .PHONY: repo_diff_from_last_version repo_diff_from_last_version: - ./script/repo_diff_last_version.sh + ./script/git/repo_diff_last_version.sh # Show git diff statistique for all repo from last tag version release .PHONY: repo_diff_stat_from_last_version repo_diff_stat_from_last_version: - ./script/repo_diff_stat_last_version.sh + ./script/git/repo_diff_stat_last_version.sh # change all repo to ssh on all remote .PHONY: repo_use_all_ssh repo_use_all_ssh: - ./script/git_change_remote_https_to_git.py + ./script/git/git_change_remote_https_to_git.py # change all repo to https on all remote .PHONY: repo_use_all_https repo_use_all_https: - ./script/git_change_remote_https_to_git.py --git_to_https + ./script/git/git_change_remote_https_to_git.py --git_to_https ################### # Configuration # @@ -967,19 +975,19 @@ config_install: # generate config all repo .PHONY: config_gen_all config_gen_all: - ./script/git_repo_update_group.py + ./script/git/git_repo_update_group.py ./script/generate_config.sh # generate config repo code_generator .PHONY: config_gen_code_generator config_gen_code_generator: - ./script/git_repo_update_group.py --group base,code_generator + ./script/git/git_repo_update_group.py --group base,code_generator ./script/generate_config.sh # generate config repo image_db .PHONY: config_gen_image_db config_gen_image_db: - ./script/git_repo_update_group.py --group base,image_db + ./script/git/git_repo_update_group.py --group base,image_db ./script/generate_config.sh ########## diff --git a/README.md b/README.md index 8b61900..a6de9d8 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,9 @@ make run ``` ## Easy way to run docker -First, install dependencies to run docker, check script `./script/install_ubuntu_docker.sh`. You need docker and docker-compose. +First, install dependencies to run docker, check script `./script/install/install_ubuntu_docker.sh`. You need docker and docker-compose. -The docker volume is binded to the directory name, therefore create a unique directory name and run: +The docker volume is bound to the directory name, therefore create a unique directory name and run: ```bash wget https://raw.githubusercontent.com/ERPLibre/ERPLibre/v1.4.0/docker-compose.yml docker-compose up -d diff --git a/conf/image_db_create.txt b/conf/image_db_create.txt index f9b6437..a9c43fc 100644 --- a/conf/image_db_create.txt +++ b/conf/image_db_create.txt @@ -12,4 +12,9 @@ ./script/make.sh image_db_create_erplibre_package_timesheet ./script/make.sh image_db_create_erplibre_package_website ./script/make.sh image_db_create_erplibre_package_wiki -./script/make.sh image_db_create_test_website_attachments \ No newline at end of file +./script/make.sh image_db_create_erplibre_package_accounting +./script/make.sh image_db_create_erplibre_package_business_requirements +./script/make.sh image_db_create_erplibre_website +./script/make.sh image_db_create_test_website_attachments +./script/make.sh image_db_create_erplibre_code_generator +./script/make.sh image_db_create_erplibre_demo \ No newline at end of file diff --git a/conf/list_cg_template_test.txt b/conf/list_cg_template_test.txt new file mode 100644 index 0000000..d1e804a --- /dev/null +++ b/conf/list_cg_template_test.txt @@ -0,0 +1,6 @@ +./script/addons/install_addons_restore_dev.sh code_generator_template_demo_internal +./script/addons/install_addons_restore_dev.sh code_generator_template_demo_internal_inherit +./script/addons/install_addons_restore_dev.sh code_generator_template_demo_mariadb_sql_example_1 +./script/addons/install_addons_restore_dev.sh code_generator_template_demo_portal +./script/addons/install_addons_restore_dev.sh code_generator_template_demo_sysadmin_cron +./script/addons/install_addons_restore_dev.sh code_generator_template_demo_website_snippet \ No newline at end of file diff --git a/conf/list_cg_test.txt b/conf/list_cg_test.txt new file mode 100644 index 0000000..66a7c24 --- /dev/null +++ b/conf/list_cg_test.txt @@ -0,0 +1,15 @@ +./script/addons/install_addons_restore_dev.sh code_generator_template_code_generator +./script/addons/install_addons_restore_dev.sh code_generator_auto_backup +./script/addons/install_addons_restore_dev.sh code_generator_demo +./script/addons/install_addons_restore_dev.sh code_generator_demo_export_helpdesk +./script/addons/install_addons_restore_dev.sh code_generator_demo_export_website +./script/addons/install_addons_restore_dev.sh code_generator_demo_export_website_attachments +./script/addons/install_addons_restore_dev.sh code_generator_demo_portal +./script/addons/install_addons_restore_dev.sh code_generator_demo_internal +./script/addons/install_addons_restore_dev.sh code_generator_demo_internal_inherit +./script/addons/install_addons_restore_dev.sh code_generator_demo_mariadb_sql_example_1 +./script/addons/install_addons_restore_dev.sh code_generator_demo_theme_website +./script/addons/install_addons_restore_dev.sh code_generator_demo_website_leaflet +./script/addons/install_addons_restore_dev.sh code_generator_demo_website_multiple_snippet +./script/addons/install_addons_restore_dev.sh code_generator_demo_website_snippet +./script/addons/install_addons_restore_dev.sh code_generator_migrator_demo_mariadb_sql_example_1 \ No newline at end of file diff --git a/conf/pycharm_default_configuration.csv b/conf/pycharm_default_configuration.csv new file mode 100644 index 0000000..7df43d0 --- /dev/null +++ b/conf/pycharm_default_configuration.csv @@ -0,0 +1,27 @@ +name,script_path,parameters,folder +run,./odoo/odoo-bin,--limit-time-real 999999 -c config.conf,run +run_parallel_test,./script/test/run_parallel_test.py,,test +cg_cg,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_code_generator,code_generator +cg_cg_template,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d template -i code_generator_template_code_generator,code_generator_template +code_generator_auto_backup,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_auto_backup,code_generator +code_generator_demo,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo,code_generator +code_generator_demo_export_helpdesk,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_export_helpdesk,code_generator +code_generator_demo_export_website,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_export_website,code_generator +code_generator_demo_export_website_attachments,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_export_website_attachments,code_generator +code_generator_demo_internal,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_internal,code_generator +code_generator_demo_internal_inherit,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_internal_inherit,code_generator +code_generator_demo_mariadb_sql_example_1,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_mariadb_sql_example_1,code_generator +code_generator_demo_portal,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_portal,code_generator +code_generator_demo_theme_website,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_theme_website,code_generator +code_generator_demo_website_leaflet,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_website_leaflet,code_generator +code_generator_demo_website_multiple_snippet,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_website_multiple_snippet,code_generator +code_generator_demo_website_snippet,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_demo_website_snippet,code_generator +code_generator_migrator_demo_mariadb_sql_example_1,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d code_generator -i code_generator_migrator_demo_mariadb_sql_example_1,code_generator_migrator +code_generator_template_demo_internal,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d template -i code_generator_template_demo_internal,code_generator_template +code_generator_template_demo_internal_inherit,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d template -i code_generator_template_demo_internal_inherit,code_generator_template +code_generator_template_demo_mariadb_sql_example_1,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d template -i code_generator_template_demo_mariadb_sql_example_1,code_generator_template +code_generator_template_demo_portal,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d template -i code_generator_template_demo_portal,code_generator_template +code_generator_template_demo_sysadmin_cron,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d template -i code_generator_template_demo_sysadmin_cron,code_generator_template +code_generator_template_demo_website_multiple_snippet,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d template -i code_generator_template_demo_website_multiple_snippet,code_generator_template +code_generator_template_demo_website_snippet,./odoo/odoo-bin,--limit-time-real 999999 --no-http -c config.conf --stop-after-init --dev cg -d template -i code_generator_template_demo_website_snippet,code_generator_template +create demo internal,./script/code_generator/new_project.py,-m demo_internal -d addons/TechnoLibre_odoo-code-generator-template,new cg project diff --git a/conf/pycharm_exclude_folder.txt b/conf/pycharm_exclude_folder.txt new file mode 100644 index 0000000..b0e4414 --- /dev/null +++ b/conf/pycharm_exclude_folder.txt @@ -0,0 +1,12 @@ +.venv +.repo +script/OCA_maintainer-tools +script/OCA_odoo-module-migrator +image_db +doc/itpp-labs_odoo-development +doc/itpp-labs_odoo-port-docs +doc/itpp-labs_odoo-test-docs +doc/odoo_documentation-user +artifacts +cache +htmlcov diff --git a/doc/CODE_GENERATOR.base.md b/doc/CODE_GENERATOR.base.md index 77b4be3..75bce54 100644 --- a/doc/CODE_GENERATOR.base.md +++ b/doc/CODE_GENERATOR.base.md @@ -12,7 +12,7 @@ Never run this on production environment, this create circular dependencies and will cause frustration to clean damage. -Ne jamais exécuter le générateur de code dans un environnement de production, il y a création de dépendances circulaires pouvant causer de la frustration à nettoyer tous les dommages. D'ailleurs, il est nécessaire d'exécuter en mode développement, avec l'argument `--dev all`. +Ne jamais exécuter le générateur de code dans un environnement de production, il y a création de dépendances circulaires pouvant causer de la frustration à nettoyer tous les dommages. D'ailleurs, il est nécessaire d'exécuter en mode développement, avec l'argument `--dev cg`. L'objectif du générateur de code est de : - utiliser le générateur via l'interface web; @@ -589,7 +589,7 @@ Supposons que le nom de votre BD est `test_website` : ```bash ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test_website --restore_image test_website_backup -./script/db_restore.py --database test_website_2 --image test_website_backup.zip --clean_cache +./script/database/db_restore.py --database test_website_2 --image test_website_backup.zip --clean_cache ``` Un fichier temporaire `./image_db/test_website_backup.zip` a été créé, vous pouvez aller l'effacer. diff --git a/doc/CODE_GENERATOR.fr.md b/doc/CODE_GENERATOR.fr.md index 40a49d7..cdcd497 100644 --- a/doc/CODE_GENERATOR.fr.md +++ b/doc/CODE_GENERATOR.fr.md @@ -1,6 +1,6 @@ # Comment générer du code -Ne jamais exécuter le générateur de code dans un environnement de production, il y a création de dépendances circulaires pouvant causer de la frustration à nettoyer tous les dommages. D'ailleurs, il est nécessaire d'exécuter en mode développement, avec l'argument `--dev all`. +Ne jamais exécuter le générateur de code dans un environnement de production, il y a création de dépendances circulaires pouvant causer de la frustration à nettoyer tous les dommages. D'ailleurs, il est nécessaire d'exécuter en mode développement, avec l'argument `--dev cg`. L'objectif du générateur de code est de : - utiliser le générateur via l'interface web; @@ -403,7 +403,7 @@ Supposons que le nom de votre BD est `test_website` : ```bash ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test_website --restore_image test_website_backup -./script/db_restore.py --database test_website_2 --image test_website_backup.zip --clean_cache +./script/database/db_restore.py --database test_website_2 --image test_website_backup.zip --clean_cache ``` Un fichier temporaire `./image_db/test_website_backup.zip` a été créé, vous pouvez aller l'effacer. diff --git a/doc/DEVELOPMENT.md b/doc/DEVELOPMENT.md index a6bd4fe..381c614 100644 --- a/doc/DEVELOPMENT.md +++ b/doc/DEVELOPMENT.md @@ -14,8 +14,8 @@ git clone https://github.com/ERPLibre/ERPLibre.git ```bash cd ERPLibre -./script/install_dev.sh -./script/install_locally_dev.sh +./script/install/install_dev.sh +./script/install/install_locally_dev.sh ``` ### 3. Run ERPLibre @@ -27,15 +27,15 @@ cd ERPLibre ## Develop in Odoo repository You need to remove `clone-depth="10"` from `./manifest/default.dev.xml` in order to be able to commit and push. Make a -temporary commit and regenerate with `./script/install_locally_dev.sh` +temporary commit and regenerate with `./script/install/install_locally_dev.sh` -## Fork project to create a new project independent from ERPLibre (deprecated) +## Fork project to create a new project independent of ERPLibre (deprecated) ERPLibre was created with this script. It's now deprecated. Use this script when you need to fork directly from the original source. Don't use this script if you want to update from ERPLibre and follow mainstream development. ```bash -./script/fork_project.py --github_token GITHUB_KEY --organization NAME +./script/git/fork_project.py --github_token GITHUB_KEY --organization NAME ``` # Fork all repos for you own organization @@ -46,7 +46,7 @@ personal account and choose your user name. This command will fork all repos and ERPLibre to your own organization. It keeps track of ERPLibre. ```bash -./script/fork_project_ERPLibre.py --github_token GITHUB_KEY --organization NAME +./script/git/fork_project_ERPLibre.py --github_token GITHUB_KEY --organization NAME ``` ## Generate manifest from csv repo @@ -56,7 +56,7 @@ Add repo in file [./source_repo_addons.csv](./source_repo_addons.csv) Execute to generate Repo manifest ```bash -./script/fork_project_ERPLibre.py --skip_fork +./script/git/fork_project_ERPLibre.py --skip_fork ``` ## Move database from prod to dev @@ -68,7 +68,7 @@ When moving database from prod to your dev environment, you want to remove email in order to test the database. Run: ```bash -./script/migrate_prod_to_test.sh DATABASE +./script/database/migrate_prod_to_test.sh DATABASE ``` ## Change git url https to Git @@ -76,7 +76,7 @@ in order to test the database. Run: This will update all urls in Git format: ```bash -./script/git_change_remote_https_to_git.py +./script/git/git_change_remote_https_to_git.py ``` ## Showing repo differences between projects @@ -84,7 +84,7 @@ This will update all urls in Git format: Tools to display the differences between the repo and another project. ```bash -./script/git_change_remote.py --sync_to /path/to/project/erplibre --dry_sync +./script/git/git_change_remote.py --sync_to /path/to/project/erplibre --dry_sync ``` ## Showing repo differences with manifest develop @@ -92,7 +92,7 @@ Tools to display the differences between the repo and another project. To understand the divergences with the dev manifest. ```bash -./script/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml +./script/git/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml ``` ## Sync repo with another project @@ -101,7 +101,7 @@ Tools to synchronise the repo with another project. This will show differences a all repos. ```bash -./script/git_change_remote.py --sync_to /path/to/project/erplibre +./script/git/git_change_remote.py --sync_to /path/to/project/erplibre ``` ## Compare two files manifests @@ -109,7 +109,7 @@ all repos. To show differences between commits in different manifests ```bash -./script/git_diff_repo_manifest.py --input1 ./manifest/MANIFEST1.xml --input2 ./manifest/MANIFEST2.xml +./script/git/git_diff_repo_manifest.py --input1 ./manifest/MANIFEST1.xml --input2 ./manifest/MANIFEST2.xml ``` ## Differences between code and manifest @@ -117,7 +117,7 @@ To show differences between commits in different manifests To show differences between actual code and manifest ```bash -./script/git_show_code_diff_repo_manifest.py --manifest ./manifest/MANIFEST1.xml +./script/git/git_show_code_diff_repo_manifest.py --manifest ./manifest/MANIFEST1.xml ``` ## Add repo @@ -127,19 +127,19 @@ To access a new repo, add your URL to file [source_repo_addons.csv](../source_re Fork the repo to be able to push new code: ```bash -./script/fork_project_ERPLibre.py +./script/git/fork_project_ERPLibre.py ``` To regenerate only manifest.xml. ```bash -./script/fork_project_ERPLibre.py --skip_fork +./script/git/fork_project_ERPLibre.py --skip_fork ``` Check if manifest contains "auto_install" and change the value to False. ```bash -./script/repo_remove_auto_install.py +./script/git/repo_remove_auto_install.py ``` ## Filter repo by group @@ -147,7 +147,7 @@ Check if manifest contains "auto_install" and change the value to False. Only keep repo tagged by group 'base' and 'code_generator' ```bash -./script/update_manifest_local_dev_code_generator.sh +./script/manifest/update_manifest_local_dev_code_generator.sh ``` # Execution @@ -157,14 +157,14 @@ Only keep repo tagged by group 'base' and 'code_generator' You can limit your addons in ERPlibre config file depending on a group of your actual manifest. ```bash -./script/git_repo_update_group.py --group base,code_generator +./script/git/git_repo_update_group.py --group base,code_generator ./script/generate_config.sh ``` Or go back to normal ```bash -./script/git_repo_update_group.py +./script/git/git_repo_update_group.py ./script/generate_config.sh ``` @@ -216,7 +216,7 @@ to version 3.7.16 . Run the installation, `make install_dev`. -Update poetry, `./script/poetry_update.py`. +Update poetry, `./script/poetry/poetry_update.py`. Create docker, `make docker_build`. @@ -225,7 +225,7 @@ Create docker, `make docker_build`. ## Show all pull requests from organization ```bash -/script/pull_request_ERPLibre.py --github_token ### --organization ERPLibre +/script/git/pull_request_ERPLibre.py --github_token ### --organization ERPLibre ``` # Commit diff --git a/doc/DISCOVER.md b/doc/DISCOVER.md index 1a83a63..9f1c21b 100644 --- a/doc/DISCOVER.md +++ b/doc/DISCOVER.md @@ -14,8 +14,8 @@ git clone https://github.com/ERPLibre/ERPLibre.git ```bash cd ERPLibre -./script/install_dev.sh -./script/install_locally_dev.sh +./script/install/install_dev.sh +./script/install/install_locally_dev.sh ``` ### 3. Run ERPLibre @@ -31,11 +31,11 @@ To access a new repo, add your URL to file [source_repo_addons.csv](../source_re Execute script: ```bash -./script/git_repo_manifest.py +./script/git/git_repo_manifest.py git checkout -b NEW_BRANCH git commit -am "Add new repo" -./script/install_locally_dev.sh -./script/poetry_update.py +./script/install/install_locally_dev.sh +./script/poetry/poetry_update.py ``` [Update your repo.](./GIT_REPO.md) diff --git a/doc/GIT_REPO.md b/doc/GIT_REPO.md index 1dd0a04..27a5fa7 100644 --- a/doc/GIT_REPO.md +++ b/doc/GIT_REPO.md @@ -63,7 +63,7 @@ When dev contains specific revision with default revision, you need to replace d keep specific version: ```bash -./script/git_merge_repo_manifest.py --input1 ./manifest/default.dev.xml --input2 ./default.xml --output ./manifest/default.staged.xml +./script/git/git_merge_repo_manifest.py --input1 ./manifest/default.dev.xml --input2 ./default.xml --output ./manifest/default.staged.xml git commit -am "Updated manifest/default.staged.xml" git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose & @@ -117,11 +117,11 @@ Before cleaning, check changed file in all repos. Check the changed branch, and push changed if needed. ```bash -./script/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml +./script/git/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml ``` Maybe, some version diverge from your manifest. Simply clean all and relaunch your installation. ```bash -./script/clean_repo_manifest.sh +./script/git/clean_repo_manifest.sh ``` diff --git a/doc/POETRY.md b/doc/POETRY.md index fc2b540..543a7f9 100644 --- a/doc/POETRY.md +++ b/doc/POETRY.md @@ -5,7 +5,7 @@ Add your dependencies in file [requirements.txt](../requirements.txt) and run script ```bash -./script/poetry_update.py +./script/poetry/poetry_update.py ``` This will search all `requirements.txt` files and update `pyproject.toml` and it will update poetry @@ -29,8 +29,8 @@ artifacts: `rm -rf artifacts/` and rerun the update. ## Upgrade Poetry -Change version in file `./script/install_locally.sh` into constant `POETRY_VERSION`. +Change version in file `./script/install/install_locally.sh` into constant `POETRY_VERSION`. Erase directory `~/.poetry` and `./get-poetry.py`. -Run installation script for OS, check `./script/install_locally.sh`. +Run installation script for OS, check `./script/install/install_locally.sh`. diff --git a/doc/PRODUCTION.md b/doc/PRODUCTION.md index 85eeed8..d9014c0 100644 --- a/doc/PRODUCTION.md +++ b/doc/PRODUCTION.md @@ -38,22 +38,22 @@ sudo ln -s /snap/bin/certbot /usr/bin/certbot #### Ubuntu 18.04 server ```bash -./script/install_dev.sh -./script/install_production.sh +./script/install/install_dev.sh +./script/install/install_production.sh ``` -A service is runned by SystemD. You can access it with the DNS name found in `env_var.sh` +A service is running by SystemD. You can access it with the DNS name found in `env_var.sh` #### Ubuntu 20.04 server Apply fix libpng12-0: https://www.linuxuprising.com/2018/05/fix-libpng12-0-missing-in-ubuntu-1804.html ```bash -./script/install_dev.sh -./script/install_production.sh +./script/install/install_dev.sh +./script/install/install_production.sh ``` -A service is runned by SystemD, you can access it with the DNS name found in `env_var.sh` +A service is running by SystemD, you can access it with the DNS name found in `env_var.sh` ### 4. SSL: @@ -101,7 +101,7 @@ When moving prod database to your dev environment, you want to remove email serv database. WARNING, this is not safe for production, you will expose all data. Run: ```bash -./script/migrate_prod_to_test.sh DATABASE +./script/database/migrate_prod_to_test.sh DATABASE ``` ## Update production @@ -125,7 +125,7 @@ Edit this file to accept interface from all networks: CAUTION, this will delete user's home, it's irrevocable. ```bash -./script/delete_production.sh +./script/database/delete_production.sh ``` # Update ip when public ip change with CloudFlare and crontab diff --git a/doc/RELEASE.md b/doc/RELEASE.md index 24a840d..dbb3625 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -8,19 +8,19 @@ Before the cleaning, check if existing file isn't committed, not pushed or in st ```bash ./.venv/repo forall -pc "git stash list" -./script/git_show_code_diff_repo_manifest.py +./script/git/git_show_code_diff_repo_manifest.py ``` This will erase everything in addons. Useful before creating docker, manifest and do a release. ```bash -./script/clean_repo_manifest.sh +./script/git/clean_repo_manifest.sh ``` And update all from dev to merge into prod. ```bash -./script/install_locally_dev.sh +./script/install/install_locally_dev.sh ``` ## Validate environment @@ -91,8 +91,8 @@ make image_db_create_all To test it, you need to clean caches and install it: ```bash -./script/db_restore.py --clean_cache -./script/db_restore.py --database test --image erplibre_website +./script/database/db_restore.py --clean_cache +./script/database/db_restore.py --database test --image erplibre_website ``` ## Generate new prod and release @@ -109,10 +109,11 @@ and [docker-compose](../docker-compose.yml). Generate [poetry](./POETRY.md) and keep only missing dependencies, remove updates. ```bash -./script/poetry_update.py +./script/poetry/poetry_update.py ``` -When running script poetry_update.py, note manually inserted dependencies, stash all changes and add it manually. +When running script ./script/poetry/poetry_update.py, note manually inserted dependencies, stash all changes and add it +manually. ```bash poetry add DEPENDENCY @@ -195,5 +196,5 @@ CHANGELOG.md. To generate a list of differences between repo git commit ```bash -./script/git_change_remote.py --sync_to /path/to/directory +./script/git/git_change_remote.py --sync_to /path/to/directory ``` diff --git a/doc/UPDATE.md b/doc/UPDATE.md index 953ad05..7f99637 100644 --- a/doc/UPDATE.md +++ b/doc/UPDATE.md @@ -8,20 +8,20 @@ The update is possible on branch 12.0, you need to verify this branch existence. regenerate. ```bash -./script/clean_repo_manifest.sh -./script/install_locally_dev.sh +./script/git/clean_repo_manifest.sh +./script/install/install_locally_dev.sh ``` 2. Update all remote with ssh/git ```bash -./script/git_change_remote_https_to_git.py +./script/git/git_change_remote_https_to_git.py ``` 3. Run update script ```bash -./script/git_update_repo.py +./script/git/git_update_repo.py ``` 4. Do a forced push on all needed repo and manage rebase conflicts. diff --git a/docker/Dockerfile.prod.pkg b/docker/Dockerfile.prod.pkg index c9beecb..1e6c33b 100644 --- a/docker/Dockerfile.prod.pkg +++ b/docker/Dockerfile.prod.pkg @@ -34,7 +34,7 @@ RUN cd $ODOO_PREFIX && \ chmod +x ./.venv/repo RUN cd $ODOO_PREFIX && \ - ./script/update_manifest_dev.sh + ./script/manifest/update_manifest_dev.sh # Install Poetry RUN cd $ODOO_PREFIX && \ diff --git a/env_var.sh b/env_var.sh index 524db03..8fb9428 100755 --- a/env_var.sh +++ b/env_var.sh @@ -23,4 +23,3 @@ EL_WEBSITE_NAME="localhost" EL_GITHUB_TOKEN="" EL_MANIFEST_PROD="./default.xml" EL_MANIFEST_DEV="./manifest/default.dev.xml" -EL_MANIFEST_EXP="./manifest/default.experimental.xml" diff --git a/manifest/default.dev.xml b/manifest/default.dev.xml index a53f8bc..18643a0 100644 --- a/manifest/default.dev.xml +++ b/manifest/default.dev.xml @@ -118,7 +118,7 @@ - + diff --git a/manifest/default.experimental.xml b/manifest/default.experimental.xml deleted file mode 100644 index 4450cfc..0000000 --- a/manifest/default.experimental.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/script/addons/coverage_install_addons_restore_dev.sh b/script/addons/coverage_install_addons_restore_dev.sh new file mode 100755 index 0000000..b33fa4b --- /dev/null +++ b/script/addons/coverage_install_addons_restore_dev.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# "$1" code_generator_name +./script/database/db_restore.py --database "$1" +./script/addons/coverage_install_addons_dev.sh "$1" "$1" diff --git a/script/addons/install_addons_dev.sh b/script/addons/install_addons_dev.sh index a8dec9e..9d6afc7 100755 --- a/script/addons/install_addons_dev.sh +++ b/script/addons/install_addons_dev.sh @@ -14,9 +14,9 @@ fi echo "Install module '$2' on BD '$1'" if [[ $# -eq 3 ]]; then - ./run.sh --no-http --stop-after-init --dev qweb -d "$1" -i "$2" -u "$2" -c "$3" + ./run.sh --no-http --stop-after-init --dev cg -d "$1" -i "$2" -u "$2" -c "$3" else - ./run.sh --no-http --stop-after-init --dev qweb -d "$1" -i "$2" -u "$2" + ./run.sh --no-http --stop-after-init --dev cg -d "$1" -i "$2" -u "$2" fi retVal=$? diff --git a/script/addons/install_addons_restore_dev.sh b/script/addons/install_addons_restore_dev.sh new file mode 100755 index 0000000..f5e2115 --- /dev/null +++ b/script/addons/install_addons_restore_dev.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# "$1" code_generator_name +./script/database/db_restore.py --database "$1" +./script/addons/install_addons_dev.sh "$1" "$1" diff --git a/script/code_generator/coverage_install_and_test_code_generator.sh b/script/code_generator/coverage_install_and_test_code_generator.sh index c43f38e..541231e 100755 --- a/script/code_generator/coverage_install_and_test_code_generator.sh +++ b/script/code_generator/coverage_install_and_test_code_generator.sh @@ -37,7 +37,7 @@ if [[ $retVal -ne 0 ]]; then fi # TODO check output when got warning -./script/repo_revert_git_diff_date_from_code_generator.py --repo "$3" +./script/git/repo_revert_git_diff_date_from_code_generator.py --repo "$3" # Remove pot and po diff cd "$3" || exit 1 # git 2.22 and more, else use next command diff --git a/script/code_generator/install_and_test_code_generator.sh b/script/code_generator/install_and_test_code_generator.sh index faaf2c5..b43919b 100755 --- a/script/code_generator/install_and_test_code_generator.sh +++ b/script/code_generator/install_and_test_code_generator.sh @@ -37,7 +37,7 @@ if [[ $retVal -ne 0 ]]; then fi # TODO check output when got warning -./script/repo_revert_git_diff_date_from_code_generator.py --repo "$3" +./script/git/repo_revert_git_diff_date_from_code_generator.py --repo "$3" # Remove pot and po diff cd "$3" || exit 1 # git 2.22 and more, else use next command diff --git a/script/code_generator/new_project.py b/script/code_generator/new_project.py index ba7a8dc..d40750a 100755 --- a/script/code_generator/new_project.py +++ b/script/code_generator/new_project.py @@ -320,7 +320,7 @@ class ProjectManagement: config_path = self.update_config() bd_name_demo = f"new_project_code_generator_demo_{uuid.uuid4()}"[:63] - cmd = f"./script/db_restore.py --database {bd_name_demo}" + cmd = f"./script/database/db_restore.py --database {bd_name_demo}" _logger.info(cmd) os.system(cmd) _logger.info("========= GENERATE code_generator_demo =========") @@ -371,7 +371,7 @@ class ProjectManagement: bd_name_template = ( f"new_project_code_generator_template_{uuid.uuid4()}"[:63] ) - cmd = f"./script/db_restore.py --database {bd_name_template}" + cmd = f"./script/database/db_restore.py --database {bd_name_template}" os.system(cmd) _logger.info(cmd) _logger.info(f"========= GENERATE {self.template_name} =========") @@ -426,7 +426,7 @@ class ProjectManagement: _logger.info(f"Module cg exists '{cg_path}'") bd_name_generator = f"new_project_code_generator_{uuid.uuid4()}"[:63] - cmd = f"./script/db_restore.py --database {bd_name_generator}" + cmd = f"./script/database/db_restore.py --database {bd_name_generator}" _logger.info(cmd) os.system(cmd) _logger.info(f"========= GENERATE {self.cg_name} =========") diff --git a/script/code_generator/transform_python_to_code_writer.py b/script/code_generator/transform_python_to_code_writer.py index 7cf75b0..e0bfcc8 100644 --- a/script/code_generator/transform_python_to_code_writer.py +++ b/script/code_generator/transform_python_to_code_writer.py @@ -7,7 +7,7 @@ import sys from code_writer import CodeWriter -from script.git_tool import GitTool +from script.git.git_tool import GitTool # import tokenize diff --git a/script/code_generator/transform_xml_to_code_writer.py b/script/code_generator/transform_xml_to_code_writer.py index d2cd863..cb71a3b 100644 --- a/script/code_generator/transform_xml_to_code_writer.py +++ b/script/code_generator/transform_xml_to_code_writer.py @@ -7,7 +7,7 @@ from xml.dom import Node, minidom from code_writer import CodeWriter -from script.git_tool import GitTool +from script.git.git_tool import GitTool def get_config(): diff --git a/script/database/README.md b/script/database/README.md index c07e2af..aec8fee 100644 --- a/script/database/README.md +++ b/script/database/README.md @@ -4,7 +4,7 @@ This section is for code generator database migrator. This configuration is for development environnement. -You need to install script `./script/install_dev_extra_ubuntu.sh`. +You need to install script `./script/install/install_dev_extra_ubuntu.sh`. ## Restore database diff --git a/script/csv/compare_database_application.py b/script/database/compare_database_application.py similarity index 94% rename from script/csv/compare_database_application.py rename to script/database/compare_database_application.py index 3c820d0..6304e52 100755 --- a/script/csv/compare_database_application.py +++ b/script/database/compare_database_application.py @@ -3,10 +3,6 @@ import argparse import csv import logging import os -import sys - -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) -sys.path.append(new_path) logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) diff --git a/script/db_restore.py b/script/database/db_restore.py similarity index 97% rename from script/db_restore.py rename to script/database/db_restore.py index a02733a..7d1fdf4 100755 --- a/script/db_restore.py +++ b/script/database/db_restore.py @@ -7,9 +7,6 @@ import os import sys from subprocess import check_output -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) -sys.path.append(new_path) - logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) _logger = logging.getLogger(__name__) diff --git a/script/delete_production.sh b/script/database/delete_production.sh similarity index 100% rename from script/delete_production.sh rename to script/database/delete_production.sh diff --git a/script/migrate_prod_to_test.sh b/script/database/migrate_prod_to_test.sh similarity index 100% rename from script/migrate_prod_to_test.sh rename to script/database/migrate_prod_to_test.sh diff --git a/script/docker/docker_update_version.py b/script/docker/docker_update_version.py index 40431b3..14d0e57 100755 --- a/script/docker/docker_update_version.py +++ b/script/docker/docker_update_version.py @@ -11,7 +11,7 @@ new_path = os.path.normpath( ) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) diff --git a/script/git/__init__.py b/script/git/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/script/clean_repo_manifest.sh b/script/git/clean_repo_manifest.sh similarity index 100% rename from script/clean_repo_manifest.sh rename to script/git/clean_repo_manifest.sh diff --git a/script/fork_project.py b/script/git/fork_project.py old mode 100644 new mode 100755 similarity index 97% rename from script/fork_project.py rename to script/git/fork_project.py index aa5af63..86fd746 --- a/script/fork_project.py +++ b/script/git/fork_project.py @@ -7,11 +7,13 @@ import sys from git import Repo from retrying import retry # pip install retrying -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) from script import fork_github_repo -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) CST_EL_GITHUB_TOKEN = "EL_GITHUB_TOKEN" diff --git a/script/fork_project_ERPLibre.py b/script/git/fork_project_ERPLibre.py similarity index 97% rename from script/fork_project_ERPLibre.py rename to script/git/fork_project_ERPLibre.py index 6aef3e7..0a1913f 100755 --- a/script/fork_project_ERPLibre.py +++ b/script/git/fork_project_ERPLibre.py @@ -7,10 +7,12 @@ import sys import git from git import Repo -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) CST_EL_GITHUB_TOKEN = "EL_GITHUB_TOKEN" diff --git a/script/git_change_remote.py b/script/git/git_change_remote.py similarity index 92% rename from script/git_change_remote.py rename to script/git/git_change_remote.py index 2dc07a4..30de84e 100755 --- a/script/git_change_remote.py +++ b/script/git/git_change_remote.py @@ -7,10 +7,12 @@ import sys from git import Repo from retrying import retry # pip install retrying -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script import git_tool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) CST_EL_GITHUB_TOKEN = "EL_GITHUB_TOKEN" @@ -22,7 +24,7 @@ def get_config(): :return: dict of config file settings and command line arguments """ - config = git_tool.GitTool.get_project_config() + config = GitTool.get_project_config() # TODO update description parser = argparse.ArgumentParser( @@ -83,14 +85,14 @@ def main(): if config.generate_only_generate_config: print("Generate config file locally.") - gt = git_tool.GitTool() + gt = GitTool() gt.generate_generate_config() return if config.sync_to: if config.sync_to[-1] != "/": config.sync_to += "/" - gt = git_tool.GitTool() + gt = GitTool() result = gt.get_matching_repo( repo_compare_to=config.sync_to, force_normalize_compare=True, @@ -100,7 +102,7 @@ def main(): return # repo_root = Repo(".") - lst_repo = git_tool.GitTool.get_repo_info(repo_path=config.dir) + lst_repo = GitTool.get_repo_info(repo_path=config.dir) i = 0 total = len(lst_repo) for repo in lst_repo: @@ -112,7 +114,7 @@ def main(): organization_name = "ERPLibre" if config.open_web_browser: - git_tool.GitTool.open_repo_web_browser(repo.get("url_https")) + GitTool.open_repo_web_browser(repo.get("url_https")) # Create the remote upstream split_url = url.split("/") diff --git a/script/git_change_remote_https_to_git.py b/script/git/git_change_remote_https_to_git.py similarity index 94% rename from script/git_change_remote_https_to_git.py rename to script/git/git_change_remote_https_to_git.py index c304167..47c85aa 100755 --- a/script/git_change_remote_https_to_git.py +++ b/script/git/git_change_remote_https_to_git.py @@ -9,10 +9,12 @@ import sys from git import Repo -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) diff --git a/script/git_diff_repo_manifest.py b/script/git/git_diff_repo_manifest.py similarity index 96% rename from script/git_diff_repo_manifest.py rename to script/git/git_diff_repo_manifest.py index 73c30e3..5234029 100755 --- a/script/git_diff_repo_manifest.py +++ b/script/git/git_diff_repo_manifest.py @@ -6,10 +6,12 @@ import sys from git import Repo -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) diff --git a/script/git_merge_repo_manifest.py b/script/git/git_merge_repo_manifest.py similarity index 94% rename from script/git_merge_repo_manifest.py rename to script/git/git_merge_repo_manifest.py index 0d84980..699fb80 100755 --- a/script/git_merge_repo_manifest.py +++ b/script/git/git_merge_repo_manifest.py @@ -5,10 +5,12 @@ import logging import os import sys -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) diff --git a/script/git_repo_manifest.py b/script/git/git_repo_manifest.py similarity index 94% rename from script/git_repo_manifest.py rename to script/git/git_repo_manifest.py index dc2a98f..536eb4a 100755 --- a/script/git_repo_manifest.py +++ b/script/git/git_repo_manifest.py @@ -4,10 +4,12 @@ import logging import os import sys -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) diff --git a/script/git_repo_update_group.py b/script/git/git_repo_update_group.py similarity index 89% rename from script/git_repo_update_group.py rename to script/git/git_repo_update_group.py index 99da140..4347a35 100755 --- a/script/git_repo_update_group.py +++ b/script/git/git_repo_update_group.py @@ -7,10 +7,12 @@ import sys import git from git import Repo -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) diff --git a/script/git_show_code_diff_repo_manifest.py b/script/git/git_show_code_diff_repo_manifest.py similarity index 97% rename from script/git_show_code_diff_repo_manifest.py rename to script/git/git_show_code_diff_repo_manifest.py index ac0688c..cd2c871 100755 --- a/script/git_show_code_diff_repo_manifest.py +++ b/script/git/git_show_code_diff_repo_manifest.py @@ -9,10 +9,12 @@ from colorama import Fore, Style from git import Repo from git.exc import GitCommandError, NoSuchPathError -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) diff --git a/script/git_tool.py b/script/git/git_tool.py similarity index 99% rename from script/git_tool.py rename to script/git/git_tool.py index 5cba620..171786a 100644 --- a/script/git_tool.py +++ b/script/git/git_tool.py @@ -259,7 +259,7 @@ class GitTool: lst_repo = [] with open(filename) as xml: xml_as_string = xml.read() - xml_dict = xmltodict.parse(xml_as_string, dict_constructor=dict) + xml_dict = xmltodict.parse(xml_as_string) dct_manifest = xml_dict.get("manifest") default_remote = dct_manifest.get("default").get("@remote") lst_remote = dct_manifest.get("remote") @@ -342,7 +342,7 @@ class GitTool: filename = f"{repo_path}/{manifest_file}" with open(filename) as xml: xml_as_string = xml.read() - xml_dict = xmltodict.parse(xml_as_string, dict_constructor=dict) + xml_dict = xmltodict.parse(xml_as_string) dct_manifest = xml_dict.get("manifest") default_remote = dct_manifest.get("default") lst_remote = dct_manifest.get("remote") @@ -721,7 +721,7 @@ class GitTool: file = f"{repo_path}/.repo/manifest.xml" with open(file) as xml: xml_as_string = xml.read() - xml_dict = xmltodict.parse(xml_as_string, dict_constructor=dict) + xml_dict = xmltodict.parse(xml_as_string) manifest_filename = ( xml_dict.get("manifest").get("include").get("@name") ) diff --git a/script/git_update_repo.py b/script/git/git_update_repo.py similarity index 93% rename from script/git_update_repo.py rename to script/git/git_update_repo.py index cbb7550..c2ef9d2 100755 --- a/script/git_update_repo.py +++ b/script/git/git_update_repo.py @@ -7,10 +7,12 @@ import sys from git import Repo # pip install gitpython from retrying import retry # pip install retrying -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) @@ -57,7 +59,10 @@ def main(): repo_path=config.dir, add_repo_root=False ) if config.start_at >= len(lst_repo): - raise Exception(f"Argument start_at need to be less then size of repo '{len(lst_repo)}'") + raise Exception( + "Argument start_at need to be less then size of repo" + f" '{len(lst_repo)}'" + ) lst_repo_organization = [ git_tool.get_transformed_repo_info_from_url( a.get("url"), @@ -68,7 +73,7 @@ def main(): revision=a.get("revision"), clone_depth=a.get("clone_depth"), ) - for a in lst_repo[config.start_at:] + for a in lst_repo[config.start_at :] ] i = 0 diff --git a/script/pull_request_ERPLibre.py b/script/git/pull_request_ERPLibre.py similarity index 95% rename from script/pull_request_ERPLibre.py rename to script/git/pull_request_ERPLibre.py index d8b31b6..5536764 100755 --- a/script/pull_request_ERPLibre.py +++ b/script/git/pull_request_ERPLibre.py @@ -4,10 +4,12 @@ import logging import os import sys -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) CST_EL_GITHUB_TOKEN = "EL_GITHUB_TOKEN" diff --git a/script/repo_diff_last_version.sh b/script/git/repo_diff_last_version.sh similarity index 100% rename from script/repo_diff_last_version.sh rename to script/git/repo_diff_last_version.sh diff --git a/script/repo_diff_stat_last_version.sh b/script/git/repo_diff_stat_last_version.sh similarity index 100% rename from script/repo_diff_stat_last_version.sh rename to script/git/repo_diff_stat_last_version.sh diff --git a/script/repo_remove_auto_install.py b/script/git/repo_remove_auto_install.py similarity index 96% rename from script/repo_remove_auto_install.py rename to script/git/repo_remove_auto_install.py index 3a3f9a4..84aa149 100755 --- a/script/repo_remove_auto_install.py +++ b/script/git/repo_remove_auto_install.py @@ -8,10 +8,12 @@ from pathlib import Path from git import Repo # pip install gitpython from git.exc import GitCommandError -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) diff --git a/script/repo_revert_git_diff_date_from_code_generator.py b/script/git/repo_revert_git_diff_date_from_code_generator.py similarity index 98% rename from script/repo_revert_git_diff_date_from_code_generator.py rename to script/git/repo_revert_git_diff_date_from_code_generator.py index 0c33a7c..9d074e8 100755 --- a/script/repo_revert_git_diff_date_from_code_generator.py +++ b/script/git/repo_revert_git_diff_date_from_code_generator.py @@ -8,7 +8,9 @@ import sys import git from unidiff import PatchSet -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) logging.basicConfig( diff --git a/script/tag_push_all.py b/script/git/tag_push_all.py similarity index 93% rename from script/tag_push_all.py rename to script/git/tag_push_all.py index fae2abc..462fada 100755 --- a/script/tag_push_all.py +++ b/script/git/tag_push_all.py @@ -8,10 +8,12 @@ from colorama import Fore, Style from git import Repo # pip install gitpython from retrying import retry # pip install retrying -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) -from script.git_tool import GitTool +from script.git.git_tool import GitTool _logger = logging.getLogger(__name__) diff --git a/script/ide/pycharm_configuration.py b/script/ide/pycharm_configuration.py new file mode 100755 index 0000000..e943162 --- /dev/null +++ b/script/ide/pycharm_configuration.py @@ -0,0 +1,399 @@ +#!./.venv/bin/python +import argparse +import csv +import logging +import os +import subprocess +import sys + +import xmltodict + +logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) + +_logger = logging.getLogger(__name__) + +PROJECT_NAME = os.path.basename(os.getcwd()) +IDEA_PATH = "./.idea" +IDEA_MISC = os.path.join(IDEA_PATH, "misc.xml") +IDEA_WORKSPACE = os.path.join(IDEA_PATH, "workspace.xml") +IDEA_PROJECT_IML = os.path.join(IDEA_PATH, PROJECT_NAME + ".iml") + +PATH_EXCLUDE_FOLDER = "./conf/pycharm_exclude_folder.txt" +if os.path.isfile(PATH_EXCLUDE_FOLDER): + with open(PATH_EXCLUDE_FOLDER) as txt: + txt_read = txt.read() + LST_EXCLUDE_FOLDER = txt_read.strip().split("\n") +else: + LST_EXCLUDE_FOLDER = [] + +PATH_DEFAULT_CONFIGURATION = "./conf/pycharm_default_configuration.csv" + + +def get_config(): + """Parse command line arguments, extracting the config file name, + returning the union of config file and command line arguments + + :return: dict of config file settings and command line arguments + """ + parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + description="""\ + Manipulate configuration for your IDE Pycharm about ERPLibre. + This script manage only Python configuration, other configuration will be ignore. +""", + epilog="""\ +""", + ) + parser.add_argument( + "--list_configuration", + action="store_true", + help=( + "List all configuration, the configuration is executable with" + " debugger." + ), + ) + parser.add_argument( + "--list_configuration_full", + action="store_true", + help=( + "List all configuration full details, the configuration is" + " executable with debugger." + ), + ) + parser.add_argument( + "--init", + action="store_true", + help="Initialize minimum configuration for Pycharm.", + ) + args = parser.parse_args() + + if args.init or args.list_configuration or args.list_configuration_full: + args.configuration = True + else: + args.configuration = False + + return args + + +def main(): + has_execute = False + config = get_config() + + # TODO modifier vcs.xml pour le mapping des répertoires git + + die( + not os.path.isdir(IDEA_PATH), + f"Missing {IDEA_PATH} path, are you sure you run this script at root" + " of the project, are you sure you have a Pycharm project?", + ) + die( + not os.path.isfile(IDEA_PROJECT_IML), + f"Missing {IDEA_PROJECT_IML} file, wait after Pycharm analyze file to" + " create Python environnement.", + ) + if config.init: + has_execute = True + read_xml_and_execute( + IDEA_PROJECT_IML, add_exclude_folder, "init", config + ) + + die( + not os.path.isfile(IDEA_MISC), + f"Missing {IDEA_MISC} file, wait after Pycharm analyze file to create" + " Python environnement. You can call --init to accelerate first" + " Pycharm analyze file.", + ) + + if config.configuration: + die( + not os.path.isfile(IDEA_WORKSPACE), + f"Missing {IDEA_WORKSPACE} file, be sure Pycharm open a project to" + " your workspace.", + ) + has_execute = True + read_xml_and_execute( + IDEA_WORKSPACE, add_configuration, "workspace", config + ) + + if not has_execute: + _logger.info("Nothing to do") + + +def read_xml_and_execute(file_name, cb, name, config): + with open(file_name) as xml: + xml_as_string = xml.read() + dct_project_xml = xmltodict.parse(xml_as_string) + # Add exclude folder + has_change = cb(dct_project_xml, file_name, config) + if has_change: + xml_format = xmltodict.unparse( + dct_project_xml, pretty=True, indent=" " + ) + with open(file_name, mode="w") as xml: + xml.write(xml_format) + _logger.info(f"File {file_name} has been write.") + subprocess.call( + "prettier --tab-width 2 --print-width 999999 --write" + f" '{file_name}'", + shell=True, + ) + else: + _logger.info(f"No change '{name}'.") + + +def add_configuration(dct_xml, file_name, config): + has_change = False + dct_project = dct_xml.get("project") + die(not bool(dct_project), f"Missing 'project' into {file_name}") + lst_component = dct_project.get("component") + die( + not bool(lst_component), + f"Missing 'project/component' into {file_name}", + ) + dct_component = [ + a for a in lst_component if a.get("@name") == "RunManager" + ] + if not dct_component: + # Create it + dct_component = { + "@name": "RunManager", + "@selected": "Python.pycharm_configuration", + "recent_temporary": { + "list": { + "item": {"@itemvalue": "Python.pycharm_configuration"} + } + }, + "configuration": [], + "list": {"item": []}, + } + lst_component.append(dct_component) + else: + dct_component = dct_component[0] + if config.list_configuration_full: + print("Configuration list detail:") + lst_configuration_full = dct_component.get("configuration") + # Create a unique list of configuration to know if we need to add a new configuration + lst_unique_configuration = [] + for conf in lst_configuration_full: + if conf.get("@factoryName") == "Python": + folder_name = conf.get("@folderName") + conf_name = conf.get("@name") + if folder_name: + conf_name = f"{folder_name}/{conf_name}" + else: + folder_name = "" + if config.list_configuration_full: + print(f"\t{conf_name}") + script_name = [ + a.get("@value").replace("$PROJECT_DIR$", ".") + for a in conf.get("option") + if a.get("@name") == "SCRIPT_NAME" + ] + if not script_name: + script_name = "" + else: + script_name = script_name[0] + param = [ + a.get("@value") + for a in conf.get("option") + if a.get("@name") == "PARAMETERS" + ] + if param: + param = param[0] + else: + param = "" + if config.list_configuration_full: + print(f"\t\t{script_name} {param}") + lst_unique_configuration.append( + f"d {folder_name} s {script_name} p {param}" + ) + if config.list_configuration: + print("Configuration list:") + lst_xml_configuration_name = dct_component.get("list").get("item") + lst_configuration = [ + a.get("@itemvalue")[7:] + for a in lst_xml_configuration_name + if a.get("@itemvalue").startswith("Python.") + ] + if config.list_configuration: + for conf in lst_configuration: + print(f"\t{conf}") + + if config.init: + if os.path.isfile(PATH_DEFAULT_CONFIGURATION): + with open(PATH_DEFAULT_CONFIGURATION) as txt: + for default_conf in csv.DictReader(txt): + conf_name = default_conf.get("name") + conf_folder = default_conf.get("folder") + conf_script_path = default_conf.get("script_path") + conf_script_path_replace = ( + conf_script_path + if not conf_script_path.startswith("./") + else f"$PROJECT_DIR${conf_script_path[1:]}" + ) + conf_parameter = default_conf.get("parameters") + s_unique_key = ( + f"d {conf_folder} s" + f" {conf_script_path} p" + f" {conf_parameter}" + ) + if s_unique_key not in lst_unique_configuration: + # add it! + if conf_name in lst_configuration: + _logger.error( + f"Cannot add configuration name '{conf_name}'," + " already exist. Delete it manually." + ) + else: + has_change = True + lst_xml_configuration_name.append( + {"@itemvalue": f"Python.conf_name"} + ) + conf_full = { + "@name": conf_name, + "@type": "PythonConfigurationType", + "@factoryName": "Python", + "module": {"@name": PROJECT_NAME}, + "option": [ + { + "@name": "INTERPRETER_OPTIONS", + "@value": "", + }, + {"@name": "PARENT_ENVS", "@value": "true"}, + { + "@name": "SDK_HOME", + "@value": ( + "$PROJECT_DIR$/.venv/bin/python" + ), + }, + { + "@name": "WORKING_DIRECTORY", + "@value": "$PROJECT_DIR$", + }, + { + "@name": "IS_MODULE_SDK", + "@value": "false", + }, + { + "@name": "ADD_CONTENT_ROOTS", + "@value": "true", + }, + { + "@name": "ADD_SOURCE_ROOTS", + "@value": "true", + }, + { + "@name": "SCRIPT_NAME", + "@value": conf_script_path_replace, + }, + { + "@name": "PARAMETERS", + "@value": conf_parameter, + }, + { + "@name": "SHOW_COMMAND_LINE", + "@value": "false", + }, + { + "@name": "EMULATE_TERMINAL", + "@value": "false", + }, + { + "@name": "MODULE_MODE", + "@value": "false", + }, + { + "@name": "REDIRECT_INPUT", + "@value": "false", + }, + {"@name": "INPUT_FILE", "@value": ""}, + ], + "envs": { + "env": { + "@name": "PYTHONUNBUFFERED", + "@value": "1", + } + }, + "EXTENSION": { + "@ID": "PythonCoverageRunConfigurationExtension", + "@runner": "coverage.py", + }, + "method": {"@v": "2"}, + } + if conf_folder: + conf_full["@folderName"] = conf_folder + lst_configuration_full.insert(0, conf_full) + else: + _logger.info(f"Configuration already exist: '{s_unique_key}'") + else: + _logger.error(f"Cannot read file '{PATH_DEFAULT_CONFIGURATION}'") + return has_change + + +def add_exclude_folder(dct_xml, file_name, config): + has_change = False + dct_module = dct_xml.get("module") + die(not bool(dct_module), f"Missing 'module' into {file_name}") + lst_component = dct_module.get("component") + die( + not bool(lst_component), f"Missing 'module/component' into {file_name}" + ) + dct_component = [ + a for a in lst_component if a.get("@name") == "NewModuleRootManager" + ] + die( + not bool(dct_component), + "Missing 'module/component @name NewModuleRootManager' into" + f" {file_name}", + ) + dct_component = dct_component[0] + dct_content = dct_component.get("content") + die( + not bool(dct_content), + "Missing 'module/component @name NewModuleRootManager/content' into" + f" {file_name}", + ) + lst_exclude_folder = dct_content.get("excludeFolder") + + lst_exclude_item = [f"file://$MODULE_DIR$/{a}" for a in LST_EXCLUDE_FOLDER] + + if lst_exclude_folder: + if type(lst_exclude_folder) is list: + lst_existing_exclude_item = [ + a.get("@url") for a in lst_exclude_folder + ] + elif type(lst_exclude_folder) is dict: + lst_existing_exclude_item = [lst_exclude_folder.get("@url")] + else: + die( + True, + "Cannot understand type of variable lst_exclude_folder:" + f" {lst_exclude_folder}", + ) + lst_diff = list( + set(lst_exclude_item).difference(set(lst_existing_exclude_item)) + ) + else: + lst_exclude_folder = [] + dct_content["excludeFolder"] = lst_exclude_folder + lst_diff = lst_exclude_item + + if lst_diff: + if type(lst_exclude_folder) is dict: + # Contain only 1 item + lst_exclude_folder = [lst_exclude_folder] + dct_content["excludeFolder"] = lst_exclude_folder + for diff in lst_diff: + lst_exclude_folder.append({"@url": diff}) + has_change = True + return has_change + + +def die(cond, message, code=1): + if cond: + print(message, file=sys.stderr) + sys.exit(code) + + +if __name__ == "__main__": + main() diff --git a/script/install_OSX_dependency.sh b/script/install/install_OSX_dependency.sh similarity index 100% rename from script/install_OSX_dependency.sh rename to script/install/install_OSX_dependency.sh diff --git a/script/install_daemon.sh b/script/install/install_daemon.sh similarity index 100% rename from script/install_daemon.sh rename to script/install/install_daemon.sh diff --git a/script/install_debian_10_prod_docker.sh b/script/install/install_debian_10_prod_docker.sh similarity index 100% rename from script/install_debian_10_prod_docker.sh rename to script/install/install_debian_10_prod_docker.sh diff --git a/script/install_debian_dependency.sh b/script/install/install_debian_dependency.sh similarity index 100% rename from script/install_debian_dependency.sh rename to script/install/install_debian_dependency.sh diff --git a/script/install_dev.sh b/script/install/install_dev.sh similarity index 77% rename from script/install_dev.sh rename to script/install/install_dev.sh index f9a7e16..739d00a 100755 --- a/script/install_dev.sh +++ b/script/install/install_dev.sh @@ -6,17 +6,17 @@ if [[ "${OSTYPE}" == "linux-gnu" ]]; then if [[ "${OS}" == "Ubuntu" ]]; then if [[ "${VERSION}" == Ubuntu\ 18.04* || "${VERSION}" == Ubuntu\ 20.04* || "${VERSION}" == Ubuntu\ 22.04* ]]; then echo "\n---- linux-gnu installation process started ----" - ./script/install_debian_dependency.sh + ./script/install/install_debian_dependency.sh else echo "Your version is not supported, only support 18.04, 20.04 and 22.04 : ${VERSION}" fi elif [[ "${OS}" == "Debian" ]]; then - ./script/install_debian_dependency.sh + ./script/install/install_debian_dependency.sh else - ./script/install_debian_dependency.sh + ./script/install/install_debian_dependency.sh echo "Your Linux system is not supported, only support Ubuntu 18.04 or Ubuntu 20.04 or Ubuntu 22.04." fi elif [[ "${OSTYPE}" == "darwin"* ]]; then echo "\n---- Darwin installation process started ----" - ./script/install_OSX_dependency.sh + ./script/install/install_OSX_dependency.sh fi diff --git a/script/install_dev_extra_ubuntu.sh b/script/install/install_dev_extra_ubuntu.sh similarity index 100% rename from script/install_dev_extra_ubuntu.sh rename to script/install/install_dev_extra_ubuntu.sh diff --git a/script/install_locally.sh b/script/install/install_locally.sh similarity index 100% rename from script/install_locally.sh rename to script/install/install_locally.sh diff --git a/script/install_locally_dev.sh b/script/install/install_locally_dev.sh similarity index 82% rename from script/install_locally_dev.sh rename to script/install/install_locally_dev.sh index dd510c3..2f4cc91 100755 --- a/script/install_locally_dev.sh +++ b/script/install/install_locally_dev.sh @@ -2,15 +2,15 @@ . ./env_var.sh -./script/install_locally.sh +./script/install/install_locally.sh retVal=$? if [[ $retVal -ne 0 ]]; then - echo "Error ./script/install_locally.sh" + echo "Error ./script/install/install_locally.sh" exit 1 fi # Update git-repo -./script/update_manifest_local_dev.sh +./script/manifest/update_manifest_local_dev.sh if [[ $retVal -ne 0 ]]; then echo "Error manifest update, check git-repo." exit 1 diff --git a/script/install_locally_prod.sh b/script/install/install_locally_prod.sh similarity index 60% rename from script/install_locally_prod.sh rename to script/install/install_locally_prod.sh index f3d31c5..d220a77 100755 --- a/script/install_locally_prod.sh +++ b/script/install/install_locally_prod.sh @@ -2,15 +2,15 @@ . ./env_var.sh -./script/install_locally.sh +./script/install/install_locally.sh retVal=$? if [[ $retVal -ne 0 ]]; then - echo "Error ./script/install_locally.sh" + echo "Error ./script/install/install_locally.sh" exit 1 fi # Update git-repo -./script/update_manifest_prod.sh +./script/manifest/update_manifest_prod.sh if [[ $retVal -ne 0 ]]; then echo "Error manifest update, check git-repo." exit 1 diff --git a/script/install_production.sh b/script/install/install_production.sh similarity index 92% rename from script/install_production.sh rename to script/install/install_production.sh index 2eba28a..5895003 100755 --- a/script/install_production.sh +++ b/script/install/install_production.sh @@ -35,7 +35,7 @@ sudo chown -R ${EL_USER}:${EL_USER} ${EL_HOME_ERPLIBRE}/env_var.sh LAST_PWD=$PWD cd ${EL_HOME_ERPLIBRE} -sudo su ${EL_USER} -c "./script/install_locally_prod.sh" +sudo su ${EL_USER} -c "./script/install/install_locally_prod.sh" cd ${LAST_PWD} #echo -e "\n* Updating server config file" #sudo su ${EL_USER} -c "printf 'logfile = /var/log/${EL_USER}/${EL_CONFIG}.log\n' >> /${EL_USER}/erplibre/config.conf" @@ -43,9 +43,9 @@ cd ${LAST_PWD} #-------------------------------------------------- # Adding ERPLIBRE as a daemon #-------------------------------------------------- -./script/install_daemon.sh +./script/install/install_daemon.sh #-------------------------------------------------- # Install Nginx if needed #-------------------------------------------------- -./script/install_production_nginx.sh \ No newline at end of file +./script/install/install_production_nginx.sh \ No newline at end of file diff --git a/script/install_production_nginx.sh b/script/install/install_production_nginx.sh similarity index 100% rename from script/install_production_nginx.sh rename to script/install/install_production_nginx.sh diff --git a/script/install_ubuntu_docker.sh b/script/install/install_ubuntu_docker.sh similarity index 100% rename from script/install_ubuntu_docker.sh rename to script/install/install_ubuntu_docker.sh diff --git a/script/manifest/compare_backup.py b/script/manifest/compare_backup.py index 0bffc3e..f125fbd 100755 --- a/script/manifest/compare_backup.py +++ b/script/manifest/compare_backup.py @@ -8,9 +8,6 @@ import zipfile from colorama import Fore, Style -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) -sys.path.append(new_path) - logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) _logger = logging.getLogger(__name__) diff --git a/script/update_manifest_dev.sh b/script/manifest/update_manifest_dev.sh similarity index 100% rename from script/update_manifest_dev.sh rename to script/manifest/update_manifest_dev.sh diff --git a/script/update_manifest_local_dev.sh b/script/manifest/update_manifest_local_dev.sh similarity index 100% rename from script/update_manifest_local_dev.sh rename to script/manifest/update_manifest_local_dev.sh diff --git a/script/update_manifest_local_dev_code_generator.sh b/script/manifest/update_manifest_local_dev_code_generator.sh similarity index 100% rename from script/update_manifest_local_dev_code_generator.sh rename to script/manifest/update_manifest_local_dev_code_generator.sh diff --git a/script/update_manifest_local_prod.sh b/script/manifest/update_manifest_local_prod.sh similarity index 100% rename from script/update_manifest_local_prod.sh rename to script/manifest/update_manifest_local_prod.sh diff --git a/script/update_manifest_prod.sh b/script/manifest/update_manifest_prod.sh similarity index 100% rename from script/update_manifest_prod.sh rename to script/manifest/update_manifest_prod.sh diff --git a/script/poetry_add_build_dependency.sh b/script/poetry/poetry_add_build_dependency.sh similarity index 85% rename from script/poetry_add_build_dependency.sh rename to script/poetry/poetry_add_build_dependency.sh index e0f5a98..9d859b4 100755 --- a/script/poetry_add_build_dependency.sh +++ b/script/poetry/poetry_add_build_dependency.sh @@ -4,7 +4,7 @@ # 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_add_build_dependency.sh" + echo "Error ./script/poetry/poetry_add_build_dependency.sh" cat ./.venv/build_dependency.txt exit 1 fi diff --git a/script/poetry_update.py b/script/poetry/poetry_update.py similarity index 98% rename from script/poetry_update.py rename to script/poetry/poetry_update.py index 082a43e..d9c1346 100755 --- a/script/poetry_update.py +++ b/script/poetry/poetry_update.py @@ -10,11 +10,6 @@ from pathlib import Path import iscompatible import toml -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) -sys.path.append(new_path) - -from script import git_tool - _logger = logging.getLogger(__name__) @@ -24,8 +19,6 @@ def get_config(): :return: dict of config file settings and command line arguments """ - config = git_tool.GitTool.get_project_config() - parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description="""\ @@ -368,7 +361,7 @@ def call_poetry_add_build_dependency(): :return: True if success """ - status = os.system("./script/poetry_add_build_dependency.sh") + status = os.system("./script/poetry/poetry_add_build_dependency.sh") return status == 0 diff --git a/script/restful/README.md b/script/restful/README.md index ce073fc..0e05eb5 100644 --- a/script/restful/README.md +++ b/script/restful/README.md @@ -13,7 +13,7 @@ The example works with application Helpdesk, install module `helpdesk_mgmt`. You need to run with specified database, and you can run the example script. ```bash -./script/db_restore.py --database test +./script/database/db_restore.py --database test ./script/addons/install_addons.sh test restful,helpdesk_mgmt ./run.sh -d test ``` diff --git a/script/test/run_parallel_test.py b/script/test/run_parallel_test.py index 1be5dea..dd8c093 100755 --- a/script/test/run_parallel_test.py +++ b/script/test/run_parallel_test.py @@ -11,9 +11,9 @@ import time import uuid from collections import deque from typing import Tuple -import git import aioshutil +import git from colorama import Fore logging.basicConfig(level=logging.DEBUG) @@ -571,7 +571,7 @@ async def test_exec( if not test_status: # Create database res, status = await run_command( - "./script/db_restore.py", + "./script/database/db_restore.py", "--database", unique_database_name, "--image", @@ -692,7 +692,12 @@ def check_git_change(): run_command( "./script/code_generator/check_git_change_code_generator.sh", "./addons/TechnoLibre_odoo-code-generator-template", - test_name="Init check_git_change", + test_name="Init check_git_change TechnoLibre_odoo-code-generator-template", + ), + run_command( + "./script/code_generator/check_git_change_code_generator.sh", + "./addons/OCA_server-tools", + test_name="Init check_git_change OCA_server-tools", ) ] commands = asyncio.gather(*task_list) diff --git a/script/update_manifest_local_experimental.sh b/script/update_manifest_local_experimental.sh deleted file mode 100755 index b96121f..0000000 --- a/script/update_manifest_local_experimental.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -. ./env_var.sh - -#EL_MANIFEST_PROD="./default.xml" -#EL_MANIFEST_DEV="./manifest/default.dev.xml" -#EL_MANIFEST_EXP="./manifest/default.experimental.xml" - -# Update git-repo -git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose & -DAEMON_PID=$! - -./.venv/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --verify HEAD) -m ${EL_MANIFEST_EXP} -./.venv/repo sync -v --force-sync -m ${EL_MANIFEST_EXP} - -kill ${DAEMON_PID} diff --git a/script/version/change_python_version.sh b/script/version/change_python_version.sh index 5459ceb..6dfb6e2 100755 --- a/script/version/change_python_version.sh +++ b/script/version/change_python_version.sh @@ -9,8 +9,8 @@ do sed -i -e "s/$line/$1/g" ./.python-version sed -i -e "s/$line/$1/g" ./docker/Dockerfile.base sed -i -e "s/$line/$1/g" ./docker/python-versions.txt - sed -i -e "s/$line/$1/g" ./script/install_locally.sh - sed -i -e "s/$line/$1/g" ./script/install_OSX_dependency.sh + sed -i -e "s/$line/$1/g" ./script/install/install_locally.sh + sed -i -e "s/$line/$1/g" ./script/install/install_OSX_dependency.sh sed -i -e "s/$line/$1/g" ./pyproject.toml done < "$input"