From 5995016568d1b0bc0153669d55de637ad5b5a4a9 Mon Sep 17 00:00:00 2001 From: Alessandro Uffreduzzi Date: Wed, 13 Mar 2024 15:51:08 +0100 Subject: [PATCH 1/2] [FIX] update copier --- .copier-answers.yml | 7 +++--- .github/workflows/pre-commit.yml | 11 +++++++- .github/workflows/test.yml | 6 ++--- .gitignore | 1 + .oca_hooks.cfg | 2 ++ .pre-commit-config.yaml | 43 +------------------------------- README.md | 20 +-------------- 7 files changed, 21 insertions(+), 69 deletions(-) create mode 100644 .oca_hooks.cfg diff --git a/.copier-answers.yml b/.copier-answers.yml index b09cb8b2b7..2cf436fcff 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,8 +1,8 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.14.2 +_commit: v1.20 _src_path: https://github.com/OCA/oca-addons-repo-template.git ci: GitHub -dependency_installation_mode: OCA +convert_readme_fragments_to_markdown: false generate_requirements_txt: true github_check_license: true github_ci_extra_env: {} @@ -11,6 +11,7 @@ github_enable_makepot: true github_enable_stale_action: true github_enforce_dev_status_compatibility: true include_wkhtmltopdf: false +odoo_test_flavor: Both odoo_version: 12.0 org_name: Odoo Community Association (OCA) org_slug: OCA @@ -58,6 +59,4 @@ repo_description: 'This project will enable real life GIS support on Odoo/OpenER repo_name: Geospatial Addons for Odoo repo_slug: geospatial repo_website: https://github.com/OCA/geospatial -travis_apt_packages: [] -travis_apt_sources: [] diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index f86d418269..0c862ddae0 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,7 +13,7 @@ jobs: pre-commit: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-python@v2 with: python-version: "3.6" @@ -27,6 +27,15 @@ jobs: run: pip install pre-commit - name: Run pre-commit run: pre-commit run --all-files --show-diff-on-failure --color=always + env: + # Consider valid a PR that changes README fragments but doesn't + # change the README.rst file itself. It's not really a problem + # because the bot will update it anyway after merge. This way, we + # lower the barrier for functional contributors that want to fix the + # readme fragments, while still letting developers get README + # auto-generated (which also helps functionals when using runboat). + # DOCS https://pre-commit.com/#temporarily-disabling-hooks + SKIP: oca-gen-addon-readme - name: Check that all files generated by pre-commit are in git run: | newfiles="$(git ls-files --others --exclude-from=.gitignore)" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 309606378b..a0f7d7c5cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest name: Detect unreleased dependencies steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: | for reqfile in requirements.txt test-requirements.txt ; do if [ -f ${reqfile} ] ; then @@ -36,10 +36,10 @@ jobs: matrix: include: - container: ghcr.io/oca/oca-ci/py3.6-odoo12.0:latest - makepot: "true" name: test with Odoo - container: ghcr.io/oca/oca-ci/py3.6-ocb12.0:latest name: test with OCB + makepot: "true" services: postgres: image: postgis/postgis:9.6-3.2 @@ -50,7 +50,7 @@ jobs: ports: - 5432:5432 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: persist-credentials: false - name: Install addons and dependencies diff --git a/.gitignore b/.gitignore index 9c283fd41f..0090721f5d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ *.py[cod] /.venv /.pytest_cache +/.ruff_cache # C extensions *.so diff --git a/.oca_hooks.cfg b/.oca_hooks.cfg new file mode 100644 index 0000000000..1f3e3e4267 --- /dev/null +++ b/.oca_hooks.cfg @@ -0,0 +1,2 @@ +[MESSAGES_CONTROL] +disable=xml-deprecated-data-node,xml-deprecated-tree-attribute diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2b7b81270..e238afee95 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,45 +56,4 @@ repos: args: - --rcfile=.pylintrc-mandatory additional_dependencies: *pylint_deps - - repo: https://github.com/myint/autoflake - rev: v1.4 - hooks: - - id: autoflake - args: - - --expand-star-imports - - --ignore-init-module-imports - - --in-place - - --remove-all-unused-imports - - --remove-duplicate-keys - - --remove-unused-variables - # - repo: https://github.com/psf/black - # rev: 22.3.0 - # hooks: - # - id: black - # - repo: https://github.com/pre-commit/mirrors-prettier - # rev: v2.1.2 - # hooks: - # - id: prettier - # name: prettier (with plugin-xml) - # additional_dependencies: - # - "prettier@2.1.2" - # - "@prettier/plugin-xml@0.12.0" - # args: - # - --plugin=@prettier/plugin-xml - # files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ - - repo: https://github.com/asottile/pyupgrade - rev: v2.7.2 - hooks: - - id: pyupgrade - args: - - --keep-percent-format - - --py36-plus - # - repo: https://github.com/PyCQA/isort - # rev: 5.12.0 - # language_version: python3.8 - # hooks: - # - id: isort - # name: isort except __init__.py - # args: - # - --settings=. - # exclude: /__init__\.py$ + diff --git a/README.md b/README.md index 3f884979d9..c3204a5d82 100644 --- a/README.md +++ b/README.md @@ -34,25 +34,7 @@ A geospatial API is provided, to add your own functionalites at your convenience [//]: # (addons) -Available addons ----------------- -addon | version | maintainers | summary ---- | --- | --- | --- -[base_geoengine](base_geoengine/) | 12.0.1.3.0 | | Geospatial support for Odoo -[base_geoengine_demo](base_geoengine_demo/) | 12.0.1.0.3 | | Geo spatial support Demo -[base_geolocalize_company](base_geolocalize_company/) | 12.0.1.0.1 | [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) | Add latitude and longitude fields on company model -[base_geolocalize_openstreetmap](base_geolocalize_openstreetmap/) | 12.0.1.1.0 | | Open street map API call to geolocalize an address -[base_google_map](base_google_map/) | 12.0.1.1.0 | [![gityopie](https://github.com/gityopie.png?size=30px)](https://github.com/gityopie) [![wolfhall](https://github.com/wolfhall.png?size=30px)](https://github.com/wolfhall) | View modes and widgets to integrate Google Maps in your UI -[geoengine_base_geolocalize](geoengine_base_geolocalize/) | 12.0.1.0.1 | | Geospatial support for base_geolocalize -[geoengine_bing](geoengine_bing/) | 12.0.1.0.2 | | GeoEngine Bing Raster Support -[geoengine_partner](geoengine_partner/) | 12.0.1.0.0 | | Geospatial support of partners -[geoengine_swisstopo](geoengine_swisstopo/) | 12.0.1.1.0 | | GeoEngine - Swisstopo layers -[test_base_geoengine](test_base_geoengine/) | 12.0.1.1.0 | | test-base-geoengine -[web_view_google_map](web_view_google_map/) | 12.0.1.1.2 | [![gityopie](https://github.com/gityopie.png?size=30px)](https://github.com/gityopie) [![wolfhall](https://github.com/wolfhall.png?size=30px)](https://github.com/wolfhall) | Add a Google Map view type to the Odoo web client -[web_view_leaflet_map](web_view_leaflet_map/) | 12.0.1.1.0 | [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) | Integrate leaflet.js librairy with odoo and add new 'leaflet_map' view, to display markers. -[web_view_leaflet_map_partner](web_view_leaflet_map_partner/) | 12.0.1.0.1 | [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) | TODO -[web_widget_google_map_drawing](web_widget_google_map_drawing/) | 12.0.1.1.0 | [![gityopie](https://github.com/gityopie.png?size=30px)](https://github.com/gityopie) [![brian10048](https://github.com/brian10048.png?size=30px)](https://github.com/brian10048) | Add drawing tools to Google Map view in Odoo -[web_widget_google_marker_icon_picker](web_widget_google_marker_icon_picker/) | 12.0.1.1.0 | [![gityopie](https://github.com/gityopie.png?size=30px)](https://github.com/gityopie) [![wolfhall](https://github.com/wolfhall.png?size=30px)](https://github.com/wolfhall) | Google map widget allowing to set marker's color +This part will be replaced when running the oca-gen-addons-table script from OCA/maintainer-tools. [//]: # (end addons) From 76c184a005fbf6f5d2f747e7d55ccee2cbd79eb6 Mon Sep 17 00:00:00 2001 From: Alessandro Uffreduzzi Date: Wed, 13 Mar 2024 16:01:18 +0100 Subject: [PATCH 2/2] [FIX] base_geongine,geongine_swisstopo: remove f-strings Partial revert of changes from 3f3f6872336b0e2c3a937d1fce24e68d86010f18 and 5ae427e8b3a02286c179c0c38bb10822b9d7f8a2 to ensure compatibility with python 3.5 --- base_geoengine/geo_model.py | 2 +- geoengine_swisstopo/geo_view/geo_raster_layer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base_geoengine/geo_model.py b/base_geoengine/geo_model.py index 5590ba50c5..10cf7e73af 100644 --- a/base_geoengine/geo_model.py +++ b/base_geoengine/geo_model.py @@ -131,7 +131,7 @@ def get_edit_info_for_geo_column(self, column): 'default_extent': view.default_extent or DEFAULT_EXTENT, 'default_zoom': view.default_zoom, } - logger.debug(f"Parameters for geo field {column}:\n{res}") + logger.debug("Parameters for geo field {}:\n{}".format(column, res)) return res @api.model diff --git a/geoengine_swisstopo/geo_view/geo_raster_layer.py b/geoengine_swisstopo/geo_view/geo_raster_layer.py index 6f44e184a9..185e2c0fbb 100644 --- a/geoengine_swisstopo/geo_view/geo_raster_layer.py +++ b/geoengine_swisstopo/geo_view/geo_raster_layer.py @@ -41,7 +41,7 @@ class GeoRasterLayer(models.Model): def _get_projection(self): for record in self: if record.raster_type == "swisstopo": - record.projection = f"EPSG:{record.matrix_set}" + record.projection = "EPSG:{}".format(record.matrix_set) else: record.projection = False