From 124d086009ec53f245707f441dd9fa783b089566 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Wed, 24 Nov 2021 18:55:16 -0500 Subject: [PATCH] ci: call the linters on the installed directory --- .flake8 | 3 --- .github/workflows/{main.yml => ci.yml} | 34 ++++++++++++++------------ CHANGELOG.md | 1 + data/diffuserc.in | 2 +- data/meson.build | 2 +- src/diffuse/constants.py.in | 3 +-- src/diffuse/main.py | 3 --- src/diffuse/meson.build | 4 +-- 8 files changed, 25 insertions(+), 27 deletions(-) rename .github/workflows/{main.yml => ci.yml} (75%) diff --git a/.flake8 b/.flake8 index 9656ec8..bc3d9c4 100644 --- a/.flake8 +++ b/.flake8 @@ -2,6 +2,3 @@ builtins = _ max-line-length = 100 show-source = true - -# Temporary -exclude = src/diffuse/main.py diff --git a/.github/workflows/main.yml b/.github/workflows/ci.yml similarity index 75% rename from .github/workflows/main.yml rename to .github/workflows/ci.yml index 1be2757..5451de4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/ci.yml @@ -18,34 +18,38 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - run: sudo apt install libgirepository1.0-dev - - run: pip install -r requirements.txt - - - name: Flake8 - run: flake8 src/ po/ - - - name: MyPy - run: mypy src/ po/ - - meson-build-test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - name: Install dependencies - run: sudo apt-get -y install appstream appstream-util desktop-file-utils gettext + run: | + sudo apt-get -y install libgirepository1.0-dev appstream appstream-util desktop-file-utils gettext + pip install -r requirements.txt - name: Meson build uses: BSFishy/meson-build@v1.0.3 with: action: build + setup-options: --prefix=/tmp/diffuse - name: Meson test uses: BSFishy/meson-build@v1.0.3 with: action: test + - name: Meson install + uses: BSFishy/meson-build@v1.0.3 + with: + action: install + + - name: Flake8 + run: | + flake8 /tmp/diffuse/ + flake8 po/ + + - name: MyPy + run: | + mypy /tmp/diffuse/ + mypy po/ + flatpak-build-test: runs-on: ubuntu-latest container: diff --git a/CHANGELOG.md b/CHANGELOG.md index 15127ee..1f253eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 io.github.mightycreak.Diffuse.appdata.xml.in - Leaner README.md - Moved the documentation to docs/ +- In the CI, call the linters on the installed directory ### Fixed - Removed the lasting lint errors (i.e. in main.py) diff --git a/data/diffuserc.in b/data/diffuserc.in index 70b36dd..9a2f221 100644 --- a/data/diffuserc.in +++ b/data/diffuserc.in @@ -2,4 +2,4 @@ # # Copyright (C) 2006-2009 Derrick Moser -import @pkgdatadir@/syntax/*.syntax +import @PKGDATADIR@/syntax/*.syntax diff --git a/data/meson.build b/data/meson.build index 019f488..f3a6234 100644 --- a/data/meson.build +++ b/data/meson.build @@ -33,7 +33,7 @@ endif # Diffuse config file conf = configuration_data() -conf.set('pkgdatadir', pkgdatadir) +conf.set('PKGDATADIR', pkgdatadir) configure_file( input: 'diffuserc.in', diff --git a/src/diffuse/constants.py.in b/src/diffuse/constants.py.in index d989e7b..241394c 100644 --- a/src/diffuse/constants.py.in +++ b/src/diffuse/constants.py.in @@ -23,9 +23,8 @@ COPYRIGHT = '''{copyright} © 2006-2019 Derrick Moser {copyright} © 2015-2021 Romain Failliot'''.format(copyright=_("Copyright")) # type: ignore WEBSITE = 'https://mightycreak.github.io/diffuse/' -LOCALEDIR = '@LOCALEDIR@' SYSCONFIGDIR = '@SYSCONFIGDIR@' -USE_FLATPAK = @USE_FLATPAK@ LOG_PRINT_OUTPUT = @LOG_PRINT_OUTPUT@ LOG_PRINT_STACK = @LOG_PRINT_STACK@ +USE_FLATPAK = @USE_FLATPAK@ diff --git a/src/diffuse/main.py b/src/diffuse/main.py index 87eb334..2db7f13 100644 --- a/src/diffuse/main.py +++ b/src/diffuse/main.py @@ -21,7 +21,6 @@ import os import sys import codecs import encodings -import gettext import shlex import stat import webbrowser @@ -1754,8 +1753,6 @@ GObject.signal_new('save-as', Diffuse.FileDiffViewer.PaneHeader, GObject.SignalF def main(): - gettext.install('diffuse', LOCALEDIR) - # app = Application() # return app.run(sys.argv) diff --git a/src/diffuse/meson.build b/src/diffuse/meson.build index d6a64cd..22c2270 100644 --- a/src/diffuse/meson.build +++ b/src/diffuse/meson.build @@ -5,7 +5,8 @@ python = import('python') conf = configuration_data() conf.set('PYTHON', python.find_installation('python3').path()) -conf.set('pkgdatadir', pkgdatadir) +conf.set('PKGDATADIR', pkgdatadir) +conf.set('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) configure_file( input: 'diffuse.in', @@ -17,7 +18,6 @@ configure_file( conf = configuration_data() conf.set('VERSION', meson.project_version()) -conf.set('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) conf.set('SYSCONFIGDIR', join_paths(get_option('prefix'), get_option('sysconfdir'))) conf.set('LOG_PRINT_OUTPUT', get_option('log_print_output')) conf.set('LOG_PRINT_STACK', get_option('log_print_stack'))