setup.cfg: make flake8 scan *.py.in files
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 5 Nov 2024 17:48:10 +0000 (12:48 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 5 Nov 2024 19:58:27 +0000 (14:58 -0500)
... in order to scan `src/bindings/python/bt2/setup.py.in` (it is a
valid Python program despite the name, the replacement tokens are only
in strings).

Make the pre-commit hooks run on this file as well (the technique is
described somewhere here [1]).

Doing so finds a small flake8 issue, fix it.

[1] https://pre-commit.com/#filtering-files-with-types

Change-Id: I1427d0d987884b72851741d6bb36620c5609ddb9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13492
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
.pre-commit-config.yaml
setup.cfg
src/bindings/python/bt2/setup.py.in

index fa852a30a70c005e170584dafcd2e88b25c2c649..4f967df6d02f585e47799b9e66a2c4293cbfb700 100644 (file)
@@ -8,14 +8,20 @@ repos:
     rev: 23.12.1
     hooks:
       - id: black
+        types: [file]
+        files: \.(py|py.in)$
         exclude: '(src/bindings/python/bt2/bt2/local_typing.py|tests/utils/python/normand.py|tests/utils/python/tap/.*|tests/utils/python/typing/.*)'
   - repo:  https://github.com/pycqa/flake8
     rev: 7.1.1
     hooks:
       - id: flake8
+        types: [file]
+        files: \.(py|py.in)$
         exclude: '(src/bindings/python/bt2/bt2/local_typing.py|tests/utils/python/normand.py|tests/utils/python/tap/.*|tests/utils/python/typing/.*)'
   - repo: https://github.com/pycqa/isort
     rev: 5.13.2
     hooks:
       - id: isort
+        types: [file]
+        files: \.(py|py.in)$
         exclude: '(src/bindings/python/bt2/bt2/local_typing.py|tests/utils/python/normand.py|tests/utils/python/tap/.*|tests/utils/python/typing/.*)'
index 331973f3d6a527af724e603797b7e7364e9b0c8f..198ff183a6359c55774c777091d0105763d984e7 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -14,6 +14,8 @@ ignore = E501,W503,E203
 #     Has code to set up the DLL search path before imports.
 per-file-ignores = src/bindings/python/bt2/bt2/__init__.py:F401,E402
 
+filename = *.py, *.py.in
+
 exclude =
        src/bindings/python/bt2/bt2/local_typing.py
        tests/utils/python/normand.py
index 47f2850622cbef18f4d8f31d78884832c2c95f32..411f715b2edc5db7ba32323120cba05a350de0e9 100644 (file)
@@ -113,7 +113,7 @@ sysconfig.get_config_vars = our_get_config_vars
 
 # Returns 'True' when running on a MinGW system.
 def is_mingw():
-    return sys.platform == "win32" and shutil.which("cygpath") != None
+    return sys.platform == "win32" and shutil.which("cygpath") is not None
 
 
 # On MinGW systems run 'cygpath -m' on 'path', on other systems return 'path' as-is.
This page took 0.027452 seconds and 4 git commands to generate.