# HG changeset patch # User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr> # Date 1686575768 -7200 # Mon Jun 12 15:16:08 2023 +0200 # Branch 15.0 # Node ID 02f6f0a20dd1a8b8208a10ceff590127361d2fc3 # Parent c318f48511dfc47b9010a7c162d7a83434097c75 ✨ make installable diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,187 @@ +env: + browser: true + es6: true + +# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 +parserOptions: + ecmaVersion: 2019 + +overrides: + - files: + - "**/*.esm.js" + parserOptions: + sourceType: module + +# Globals available in Odoo that shouldn't produce errorings +globals: + _: readonly + $: readonly + fuzzy: readonly + jQuery: readonly + moment: readonly + odoo: readonly + openerp: readonly + owl: readonly + +# Styling is handled by Prettier, so we only need to enable AST rules; +# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890 +rules: + accessor-pairs: warn + array-callback-return: warn + callback-return: warn + capitalized-comments: + - warn + - always + - ignoreConsecutiveComments: true + ignoreInlineComments: true + complexity: + - warn + - 15 + constructor-super: warn + dot-notation: warn + eqeqeq: warn + global-require: warn + handle-callback-err: warn + id-blacklist: warn + id-match: warn + init-declarations: error + max-depth: warn + max-nested-callbacks: warn + max-statements-per-line: warn + no-alert: warn + no-array-constructor: warn + no-caller: warn + no-case-declarations: warn + no-class-assign: warn + no-cond-assign: error + no-const-assign: error + no-constant-condition: warn + no-control-regex: warn + no-debugger: error + no-delete-var: warn + no-div-regex: warn + no-dupe-args: error + no-dupe-class-members: error + no-dupe-keys: error + no-duplicate-case: error + no-duplicate-imports: error + no-else-return: warn + no-empty-character-class: warn + no-empty-function: error + no-empty-pattern: error + no-empty: warn + no-eq-null: error + no-eval: error + no-ex-assign: error + no-extend-native: warn + no-extra-bind: warn + no-extra-boolean-cast: warn + no-extra-label: warn + no-fallthrough: warn + no-func-assign: error + no-global-assign: error + no-implicit-coercion: + - warn + - allow: ["~"] + no-implicit-globals: warn + no-implied-eval: warn + no-inline-comments: warn + no-inner-declarations: warn + no-invalid-regexp: warn + no-irregular-whitespace: warn + no-iterator: warn + no-label-var: warn + no-labels: warn + no-lone-blocks: warn + no-lonely-if: error + no-mixed-requires: error + no-multi-str: warn + no-native-reassign: error + no-negated-condition: warn + no-negated-in-lhs: error + no-new-func: warn + no-new-object: warn + no-new-require: warn + no-new-symbol: warn + no-new-wrappers: warn + no-new: warn + no-obj-calls: warn + no-octal-escape: warn + no-octal: warn + no-param-reassign: warn + no-path-concat: warn + no-process-env: warn + no-process-exit: warn + no-proto: warn + no-prototype-builtins: warn + no-redeclare: warn + no-regex-spaces: warn + no-restricted-globals: warn + no-restricted-imports: warn + no-restricted-modules: warn + no-restricted-syntax: warn + no-return-assign: error + no-script-url: warn + no-self-assign: warn + no-self-compare: warn + no-sequences: warn + no-shadow-restricted-names: warn + no-shadow: warn + no-sparse-arrays: warn + no-sync: warn + no-this-before-super: warn + no-throw-literal: warn + no-undef-init: warn + no-undef: error + no-unmodified-loop-condition: warn + no-unneeded-ternary: error + no-unreachable: error + no-unsafe-finally: error + no-unused-expressions: error + no-unused-labels: error + no-unused-vars: error + no-use-before-define: error + no-useless-call: warn + no-useless-computed-key: warn + no-useless-concat: warn + no-useless-constructor: warn + no-useless-escape: warn + no-useless-rename: warn + no-void: warn + no-with: warn + operator-assignment: [error, always] + prefer-const: warn + radix: warn + require-yield: warn + sort-imports: warn + spaced-comment: [error, always] + strict: [error, function] + use-isnan: error + valid-jsdoc: + - warn + - prefer: + arg: param + argument: param + augments: extends + constructor: class + exception: throws + func: function + method: function + prop: property + return: returns + virtual: abstract + yield: yields + preferType: + array: Array + bool: Boolean + boolean: Boolean + number: Number + object: Object + str: String + string: String + requireParamDescription: false + requireReturn: false + requireReturnDescription: false + requireReturnType: false + valid-typeof: warn + yoda: warn diff --git a/.flake8 b/.flake8 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,5 @@ [flake8] max-line-length = 88 +per-file-ignores= + __init__.py:F401 + __manifest__.py:B018 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,6 @@ include: - project: xcg/ci-templates file: /odoo/15.0/gitlab-ci.yaml + +variables: + CI_TEMPLATE_NO_INSTALL_MODULE: "" diff --git a/NEWS.rst b/NEWS.rst --- a/NEWS.rst +++ b/NEWS.rst @@ -1,6 +1,11 @@ Changelog ========= +15.0.1.0.2 +---------- + +Module is now installable as a python package. + 15.0.1.0.1 ---------- diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -2,13 +2,6 @@ ICU Format ========== -.. |coverage| image:: .badges/coverage.svg - :target: https://orus.io/xcg/odoo-modules/icuformat/-/pipelines?ref=branch/15.0 - :alt: Coverage report -.. |pylint| image:: .badges/pylint.svg - :target: https://orus.io/xcg/odoo-modules/icuformat/-/pipelines?ref=branch/15.0 - :alt: pylint score -.. Update the badge below depending on status .. |maturity| image:: .badges/maturity.svg :target: https://odoo-community.org/page/development-status :alt: Alpha @@ -22,7 +15,7 @@ :target: https://github.com/prettier/prettier :alt: Prettier -|coverage| |pylint| |maturity| |license| |black| |prettier| +|maturity| |license| |black| |prettier| Provides methods that encapsulates PyICU. diff --git a/__init__.py b/__init__.py --- a/__init__.py +++ b/__init__.py @@ -1,4 +1,4 @@ -from . import models # noqa: F401 -from .hooks import post_load # noqa: F401 -from .icu_format import ICUFormatter, icu_format, icu_list_format # noqa: F401 -from .logger import get_logger # noqa: F401 +from . import models +from .hooks import post_load +from .icu_format import ICUFormatter, icu_format, icu_list_format +from .logger import get_logger diff --git a/__manifest__.py b/__manifest__.py --- a/__manifest__.py +++ b/__manifest__.py @@ -1,7 +1,7 @@ ############################################################################## # # ICU Format, a module for Odoo -# Copyright (C) 2019-2021, 2022 XCG Consulting <https://xcg-consulting.fr/> +# Copyright © 2019-2021, 2022 XCG Consulting <https://xcg-consulting.fr/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -21,10 +21,10 @@ { "name": "ICU Format", "summary": "Format message using ICU", - "version": "15.0.1.0.1", + "version": "15.0.1.0.2", "category": "Technical", "author": "XCG Consulting", - "website": "https://odoo.consulting/", + "website": "https://orbeet.io/", "license": "AGPL-3", "depends": ["base"], "external_dependencies": {"python": ["PyICU"]}, diff --git a/doc/autotodo.py b/doc/autotodo.py --- a/doc/autotodo.py +++ b/doc/autotodo.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2014, 2018, 2022 XCG Consulting +# Copyright © 2014, 2018, 2022 XCG Consulting # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -99,8 +99,8 @@ res[tag].extend(info) -def scan_file(filename, tags) -> tuple[dict[str, tuple[str, int, str]], int]: - res = {tag: [] for tag in tags} +def scan_file(filename, tags) -> tuple[dict[str, list[tuple[str, int, str]]], int]: + res: dict[str, list[tuple[str, int, str]]] = {tag: [] for tag in tags} line_num: int = 0 with open(filename, "r") as f: for line_num, line in enumerate(f): diff --git a/doc/conf.py b/doc/conf.py --- a/doc/conf.py +++ b/doc/conf.py @@ -34,7 +34,7 @@ "sphinx.ext.coverage", "sphinx.ext.graphviz", "sphinx.ext.viewcode", - "sphinxodoo.ext.autodoc", + "sphinxodooautodoc.ext.autodoc", ] # Add any paths that contain templates here, relative to this directory. @@ -145,18 +145,19 @@ intersphinx_mapping = {"https://docs.python.org/3/": None} -# -# odoo-sphinx-autodoc -# +# -- Options for sphinx-odoo-autodoc extension ---------------------------- -# sphinxodoo_addons : List of addons name to load (if empty, no addon will be loaded) +# sphinxodooautodoc_addons : List of addons name to load (if empty, no addon will be +# loaded) this_module = os.path.basename( os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ) -sphinxodoo_addons = [this_module] -# sphinxodoo_root_path : Path of the Odoo root directory -sphinxodoo_root_path = os.path.dirname(os.path.dirname(os.path.abspath(odoo.__file__))) -# sphinxodoo_addons_path : List of paths were Odoo addons to load are located +sphinxodooautodoc_addons = [this_module] +# sphinxodooautodoc_root_path : Path of the Odoo root directory +sphinxodooautodoc_root_path = os.path.dirname( + os.path.dirname(os.path.abspath(odoo.__file__)) +) +# sphinxodooautodoc_addons_path : List of paths were Odoo addons to load are located c = None # find setup file of superproject, if any directory = os.path.dirname(os.getenv("PWD")) @@ -167,7 +168,7 @@ c.read(setup_path) if c.has_section("odoo_scripts"): # reload with odoo_scripts - c = Configuration(os.path.dirname(setup_path)) + c = Configuration(directory) else: c = None if not c: @@ -176,17 +177,19 @@ else: directory = None -sphinxodoo_addons_path = list() +sphinxodooautodoc_addons_path = [] if c: addon_dirs = set(os.path.dirname(path) for path in c.modules) for line in addon_dirs: - sphinxodoo_addons_path.append(os.path.join(directory, line)) + sphinxodooautodoc_addons_path.append(os.path.join(directory, line)) else: # add this directory top dir - sphinxodoo_addons_path.append(os.path.dirname(os.path.dirname(os.getenv("PWD")))) + sphinxodooautodoc_addons_path.append( + os.path.dirname(os.path.dirname(os.getenv("PWD"))) + ) other_addons = os.getenv("ODOO_ADDONS_PATH", default=None) if other_addons: for addon_path in other_addons.split(","): - sphinxodoo_addons_path.append(addon_path) + sphinxodooautodoc_addons_path.append(addon_path) diff --git a/doc/index.rst b/doc/index.rst --- a/doc/index.rst +++ b/doc/index.rst @@ -1,3 +1,12 @@ +.. |coverage| image:: .badges/coverage.svg + :target: https://orus.io/xcg/odoo-modules/icuformat/-/pipelines?ref=branch/15.0 + :alt: Coverage report +.. |pylint| image:: .badges/pylint.svg + :target: https://orus.io/xcg/odoo-modules/icuformat/-/pipelines?ref=branch/15.0 + :alt: pylint score + +|coverage| |pylint| + .. include:: README.rst Contents: @@ -15,4 +24,3 @@ * :ref:`genindex` * :ref:`modindex` * :ref:`search` - diff --git a/hooks.py b/hooks.py --- a/hooks.py +++ b/hooks.py @@ -1,7 +1,7 @@ ############################################################################## # # ICU Format, a module for Odoo -# Copyright (C) 2021 XCG Consulting <https://odoo.consulting> +# Copyright © 2021 XCG Consulting <https://odoo.consulting> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/icu_format.py b/icu_format.py --- a/icu_format.py +++ b/icu_format.py @@ -1,7 +1,7 @@ ############################################################################## # # ICU Format, a module for Odoo -# Copyright (C) 2019-2021 XCG Consulting <https://odoo.consulting> +# Copyright © 2019-2021 XCG Consulting <https://odoo.consulting> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/logger.py b/logger.py --- a/logger.py +++ b/logger.py @@ -1,7 +1,7 @@ ############################################################################## # # ICU Format, a module for Odoo -# Copyright (C) 2019-2021 XCG Consulting <https://odoo.consulting> +# Copyright © 2019-2021 XCG Consulting <https://odoo.consulting> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/models/base.py b/models/base.py --- a/models/base.py +++ b/models/base.py @@ -1,7 +1,7 @@ ############################################################################## # # ICU Format, a module for Odoo -# Copyright (C) 2021, 2022 XCG Consulting (https://xcg-consulting.fr/) +# Copyright © 2021, 2022 XCG Consulting (https://xcg-consulting.fr/) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/models/currency.py b/models/currency.py --- a/models/currency.py +++ b/models/currency.py @@ -1,7 +1,7 @@ ############################################################################## # # ICU Format, a module for Odoo -# Copyright (C) 2021, 2022 XCG Consulting <https://xcg-consulting.fr/> +# Copyright © 2021, 2022 XCG Consulting <https://xcg-consulting.fr/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/pyproject.toml b/pyproject.toml --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,44 @@ +[project] +name = "odoo-addon-icuformat" +dynamic = ["version"] +readme = "README.rst" +requires-python = "~=3.10.0" +license = { file = "LICENSE", name = "GNU Affero General Public License v3" } +keywords = ["odoo"] +authors = [{ name = "XCG Consulting" }] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Framework :: Odoo", + "Framework :: Odoo :: 15.0", + "License :: OSI Approved :: GNU Affero General Public License v3" +] +dependencies = ["odoo==15.0.*"] + +[project.optional-dependencies] +doc = ["sphinx", "sphinx-odoo-autodoc"] +test = [] + +[project.urls] +repository = "https://orus.io/xcg/odoo-modules/icuformat" +changelog = "https://orus.io/xcg/odoo-modules/icuformat/-/blob/branch/15.0/NEWS.rst" + +[build-system] +requires = ["setuptools >=64.0.0", "wheel", "setuptools_scm[toml] >=6.2"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +package-dir = { "odoo.addons.icuformat" = "." } + +[tool.setuptools.package-data] +"*" = ["*"] + +[tool.setuptools_scm] + +[tool.black] +target = 3.10 + [tool.isort] py_version = 310 profile = "black" @@ -12,6 +53,3 @@ 'FIRSTPARTY', 'LOCALFOLDER' ] - -[tool.black] -target = 3.10 diff --git a/tests/__init__.py b/tests/__init__.py --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,2 +1,1 @@ -from . import test_icuformat # noqa: F401 -from . import test_logger # noqa: F401 +from . import test_icuformat, test_logger diff --git a/tests/test_icuformat.py b/tests/test_icuformat.py --- a/tests/test_icuformat.py +++ b/tests/test_icuformat.py @@ -1,7 +1,7 @@ ############################################################################### # # ICU Format, a module for Odoo -# Copyright (C) 2019, 2021, 2022 XCG Consulting (https://xcg-consulting.fr/) +# Copyright © 2019, 2021, 2022 XCG Consulting (https://xcg-consulting.fr/) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/tests/test_logger.py b/tests/test_logger.py --- a/tests/test_logger.py +++ b/tests/test_logger.py @@ -1,7 +1,7 @@ ############################################################################### # # ICU Format, a module for Odoo -# Copyright (C) 2019, 2021, 2022 XCG Consulting (https://xcg-consulting.fr/) +# Copyright © 2019, 2021, 2022 XCG Consulting (https://xcg-consulting.fr/) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as