glib/tests/flake8.sh
Simon McVittie 9f18bb6258 tests: Search the appropriate directories for our GIR XML inputs
During "as-installed" testing, we should search the GIR_DIR for GIR XML,
instead of hard-coding that it is `${prefix}/share/gir-1.0`. This is
not the case on at least Debian, in order to make it possible to
install more than one architecture's flavour of `GLib-2.0.gir`,
which contains some architecture-specific `#define`s.

Also search GOBJECT_INTROSPECTION_DATADIR/GIR_SUFFIX (in practice
something like `/usr/share/gir-1.0` in all cases) to accommodate
distributions like Debian that move the architecture-independent
majority of GIR XML into /usr/share to avoid duplication, leaving
only the architecture-specific minority of files like `GLib-2.0.gir`
in the GIR_DIR.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-02-21 16:40:47 +00:00

29 lines
780 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2020 Frederic Martinsons
# Copyright 2020 Endless OS Foundation, LLC
# Copyright 2024 Collabora Ltd.
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eu
if [ -z "${G_TEST_SRCDIR-}" ]; then
me="$(readlink -f "$0")"
G_TEST_SRCDIR="${me%/*}"
fi
export TEST_NAME=flake8
export TEST_REQUIRES_TOOLS="flake8 git"
run_lint () {
# Disable formatting warnings in flake8, as we use `black` to handle that.
local formatting_warnings=E101,E111,E114,E115,E116,E117,E12,E13,E2,E3,E401,E5,E70,W1,W2,W3,W5
# shellcheck disable=SC2046
flake8 \
--max-line-length=88 --ignore="$formatting_warnings" \
$(git ls-files '*.py' 'tests/lib/*.py.in')
}
# shellcheck source=tests/lint-common.sh
. "$G_TEST_SRCDIR/lint-common.sh"