diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1f4b4a10..12f1f4dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,11 +2,11 @@ default_language_version: python: python3 repos: - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + rev: v4.3.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -20,19 +20,20 @@ repos: - id: mixed-line-ending args: ["--fix=lf"] - repo: https://github.com/asottile/seed-isort-config - rev: v1.9.3 + rev: v2.2.0 hooks: - id: seed-isort-config - repo: https://github.com/pre-commit/mirrors-isort - rev: v4.3.21 + rev: v5.10.1 hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.2.1 + rev: v2.7.1 hooks: - id: prettier - repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs - rev: v1.1.0 + rev: v1.1.2 hooks: - id: markdown-toc args: [--bullets=-, -i] + exclude: .github/ diff --git a/README.md b/README.md index 5e327ca5..205733ab 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,9 @@ it work anywhere quickly. You can start working with this straight away with our [template][]. + + + - [Image usage](#image-usage) @@ -78,6 +81,8 @@ You can start working with this straight away with our [template][]. + + ## Image usage Basically, every directory you have to worry about is found inside `/opt/odoo`. This is diff --git a/bin/addons b/bin/addons index 5be5f1d3..18c0dfb3 100755 --- a/bin/addons +++ b/bin/addons @@ -139,6 +139,6 @@ else: if args.test: command += ["--test-enable", "--workers", "0"] if os.environ.get("PGDATABASE"): - command += ["--db-filter", u"^{}$".format(os.environ.get("PGDATABASE"))] + command += ["--db-filter", "^{}$".format(os.environ.get("PGDATABASE"))] logger.info("Executing %s", " ".join(command)) check_call(command) diff --git a/build.d/800-permissions b/build.d/800-permissions index a34dc176..312ab845 100755 --- a/build.d/800-permissions +++ b/build.d/800-permissions @@ -3,7 +3,6 @@ import os.path from doodbalib import AUTO_DIR, CUSTOM_DIR - from plumbum import FG, local find, xargs, chmod, chown = ( diff --git a/entrypoint.d/45-geoip b/entrypoint.d/45-geoip index f467f7c6..85df2a9e 100755 --- a/entrypoint.d/45-geoip +++ b/entrypoint.d/45-geoip @@ -5,7 +5,6 @@ import re import sys from doodbalib import logger - from plumbum import BG, local from plumbum.cmd import geoipupdate diff --git a/hooks/build b/hooks/build index c7526b46..2fc238b3 100755 --- a/hooks/build +++ b/hooks/build @@ -15,21 +15,24 @@ tag = local["docker"]["image", "tag"] # Build base and onbuild images for target, suffix in (("base", ""), ("onbuild", "-onbuild")): image_name = "%s:%s%s" % (REPO, VERSION, suffix) - build[ - "--build-arg", - "VCS_REF=%s" % COMMIT, - "--build-arg", - "BUILD_DATE=%s" % date().strip(), - "--build-arg", - "ODOO_VERSION=%s" % VERSION, - "--tag", - image_name, - "--target", - target, - "--file", - "%s.Dockerfile" % VERSION, - ROOT, - ] & FG + ( + build[ + "--build-arg", + "VCS_REF=%s" % COMMIT, + "--build-arg", + "BUILD_DATE=%s" % date().strip(), + "--build-arg", + "ODOO_VERSION=%s" % VERSION, + "--tag", + image_name, + "--target", + target, + "--file", + "%s.Dockerfile" % VERSION, + ROOT, + ] + & FG + ) # Tag "latest" image if applicable if VERSION == local.env.get("LATEST_RELEASE"): diff --git a/lib/doodbalib/__init__.py b/lib/doodbalib/__init__.py index e0264c80..6da810b9 100644 --- a/lib/doodbalib/__init__.py +++ b/lib/doodbalib/__init__.py @@ -159,7 +159,7 @@ def addons_config(filtered=True, strict=False): # Other addons fall in between if filtered and len(repos) != 1: raise AddonsConfigError( - u"Addon {} defined in several repos {}".format(addon, repos) + "Addon {} defined in several repos {}".format(addon, repos) ) for repo in repos: yield addon, repo diff --git a/tests/__init__.py b/tests/__init__.py index 9f3bf780..08d423ac 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -123,7 +123,11 @@ def test_addons_filtered(self): "-xc", 'test "$(addons list -dw private_addon -W dummy_addon)" == base,website', ), - ("bash", "-xc", 'test "$(addons list -nd)" == base,iap',), + ( + "bash", + "-xc", + 'test "$(addons list -nd)" == base,iap', + ), ( "bash", "-xc", @@ -556,7 +560,11 @@ def test_geoip(self): for sub_env in matrix(): self.compose_test( geoip_dir, - dict(sub_env, UID=str(os.getuid()), GID=str(os.getgid()),), + dict( + sub_env, + UID=str(os.getuid()), + GID=str(os.getgid()), + ), # verify that geoipupdate works after waiting for entrypoint to finish its update ( "bash", @@ -634,7 +642,11 @@ def test_symlinks(self): "/opt/odoo/auto/addons/addon_alias/__openerp__.py", ), # verify that symlinking outside the src directory doesn't enable changing permission of important stuff - ("bash", "-c", '[[ "$(stat -c %U:%G /bin/date)" == "root:root" ]]',), + ( + "bash", + "-c", + '[[ "$(stat -c %U:%G /bin/date)" == "root:root" ]]', + ), # verify that everything in src dir (except symlinks) is accessible by odoo ( "bash",