diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2023-12-20 14:23:01 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2023-12-20 14:30:11 +1000 |
commit | 3998ddde5bda96538fadd7de42a63f0b7c43d85d (patch) | |
tree | 168ac1082bfefbb177d7529c5ecf6c44ef44204f | |
parent | 6cd55ec6ecbdd25d2ec13ccae60cf67eb47d162f (diff) |
CI: drop black, use ruff-format instead
black is getting increasingly more difficult to use in the CI across
distribution versions (thanks to Python's messy packaging) so let's
replace it with ruff format which produces largely the same results.
-rw-r--r-- | .gitlab-ci.yml | 17 | ||||
-rw-r--r-- | .pre-commit-config.yaml | 8 | ||||
-rwxr-xr-x | rules/compat/map-variants.py | 18 |
3 files changed, 25 insertions, 18 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e6a0635e..a73725e2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,7 +32,7 @@ variables: # Changing the tag will rebuild the container images. The value is just a # string, but we use the date for human benefits. - FDO_DISTRIBUTION_TAG: '2022-01-20.0' + FDO_DISTRIBUTION_TAG: '2023-12-20.0' # xkbcommon: needed to share artifacts between jobs XKBCOMMON_DIR: 'libxkbcommon' @@ -57,7 +57,7 @@ container-prep: # minimal set of packages required to build xkeyboard-config. BASE_PACKAGES: 'xorg-util-macros gettext pkg-config gcc grep m4 python meson ninja git diffutils' # extra packages we need for various tests - EXTRA_PACKAGES: 'tree libxml2 bison xorg-xkbcomp python-pytest python-libevdev python-yaml yq libxkbcommon libxslt python-pycountry' + EXTRA_PACKAGES: 'tree libxml2 bison xorg-xkbcomp python-pytest python-libevdev python-yaml yq libxkbcommon libxslt python-pycountry ruff' FDO_DISTRIBUTION_PACKAGES: $BASE_PACKAGES $EXTRA_PACKAGES @@ -118,16 +118,13 @@ check-commit: # # Format Python code with python-black # -python-black: +ruff-format: extends: - - .fdo.ci-fairy - stage: sanity - before_script: - - python3 -m venv venv - - source venv/bin/activate - - pip3 install black + - .default_setup + stage: test script: - - black --check --diff . + - ruff format --line-length=88 --check --diff . + needs: ['container-prep'] meson_install: extends: .meson_build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a098ad69..f49864e0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,13 +4,11 @@ repos: hooks: - id: end-of-file-fixer - id: trailing-whitespace -- repo: https://github.com/psf/black - rev: 23.12.0 - hooks: - - id: black - args: ['--check', '--diff', '.'] - repo: https://github.com/charliermarsh/ruff-pre-commit rev: v0.1.8 hooks: - id: ruff args: ['--ignore=E741,E501', '.',] + - id: ruff-format + # 88 is the black default + args: ['--line-length=88', '.',] diff --git a/rules/compat/map-variants.py b/rules/compat/map-variants.py index 5f4b5e6f..3bf44d42 100755 --- a/rules/compat/map-variants.py +++ b/rules/compat/map-variants.py @@ -71,7 +71,11 @@ def write_layout_n(dest, mappings, number, write_header): second_layout = ( str(l2) if l2.variant else "{}%(v[{}])".format(l2.layout, number) ) - dest.write(" * {} = {}+{}{}\n".format(l1, base, second_layout, suffix)) + dest.write( + " * {} = {}+{}{}\n".format( + l1, base, second_layout, suffix + ) + ) # mlv_s @@ -79,13 +83,21 @@ def write_fixed_layout_variant(dest, mappings, write_header): if write_header: dest.write("! model layout variant = symbols\n") for l1, l2 in mappings: - dest.write(" * {} {} = pc+{}\n".format(l1.layout, l1.variant, l2)) + dest.write( + " * {} {} = pc+{}\n".format( + l1.layout, l1.variant, l2 + ) + ) # mlnvn_s def write_layout_n_variant_n(dest, mappings, number, write_header): if write_header: - dest.write("! model layout[{}] variant[{}] = symbols\n".format(number, number)) + dest.write( + "! model layout[{}] variant[{}] = symbols\n".format( + number, number + ) + ) # symbols is # +layout(variant):2 |