Skip to content

Commit

Permalink
[IMP] pre-commit update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tardo committed Jun 21, 2022
1 parent 1366652 commit ee5d9ac
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 28 deletions.
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ it work anywhere quickly.

You can start working with this straight away with our [template][].

<!-- prettier-ignore-start -->
<!-- prettier-ignore -->

<!-- toc -->

- [Image usage](#image-usage)
Expand Down Expand Up @@ -78,6 +81,8 @@ You can start working with this straight away with our [template][].

<!-- tocstop -->

<!-- prettier-ignore-end -->

## Image usage

Basically, every directory you have to worry about is found inside `/opt/odoo`. This is
Expand Down
2 changes: 1 addition & 1 deletion bin/addons
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 0 additions & 1 deletion build.d/800-permissions
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os.path

from doodbalib import AUTO_DIR, CUSTOM_DIR

from plumbum import FG, local

find, xargs, chmod, chown = (
Expand Down
1 change: 0 additions & 1 deletion entrypoint.d/45-geoip
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import re
import sys

from doodbalib import logger

from plumbum import BG, local
from plumbum.cmd import geoipupdate

Expand Down
33 changes: 18 additions & 15 deletions hooks/build
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
2 changes: 1 addition & 1 deletion lib/doodbalib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 15 additions & 3 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit ee5d9ac

Please sign in to comment.