From d7f3d4afbc1b1678effcc1658d88edf0e5c1c685 Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Fri, 7 Jul 2023 10:44:25 +0200 Subject: [PATCH] avoid generating python bytecode We may want to include these scripts into kernel git repositories, so better to avoid generating python bytecode to avoid including unnecessary artifacts. Signed-off-by: Andrea Righi --- kconfig/run.py | 10 ++++++++-- kconfig/sanitize.py | 3 +++ setup.cfg | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/kconfig/run.py b/kconfig/run.py index fc7485e..27431d5 100644 --- a/kconfig/run.py +++ b/kconfig/run.py @@ -4,6 +4,9 @@ # Copyright © 2022 Canonical Ltd. import sys + +sys.dont_write_bytecode = True + import os import argparse import json @@ -16,6 +19,7 @@ except ModuleNotFoundError: def autocomplete(_unused): pass + from kconfig.annotations import Annotation, KConfig from kconfig.utils import autodetect_annotations, arg_fail from kconfig.version import VERSION @@ -276,8 +280,10 @@ def do_check(args): num = total - good if ret: - if os.path.exists('.git'): - print(f"check-config: {num} config options have been changed, review them with `git diff`") + if os.path.exists(".git"): + print( + f"check-config: {num} config options have been changed, review them with `git diff`" + ) else: print(f"check-config: {num} config options have changed") else: diff --git a/kconfig/sanitize.py b/kconfig/sanitize.py index c393284..1aa962c 100755 --- a/kconfig/sanitize.py +++ b/kconfig/sanitize.py @@ -5,6 +5,9 @@ # Copyright © 2023 Canonical Ltd. import sys + +sys.dont_write_bytecode = True # pylint: disable=E0402 + import re import argparse from argcomplete import autocomplete diff --git a/setup.cfg b/setup.cfg index 7fc88b3..91700f5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,8 @@ max_line_length = 120 per-file-ignores = # E402 module level import not at top of file - annotations: E402 + kconfig/run.py:E402, + kconfig/sanitize.py:E402 [pylint.FORMAT] -- 2.31.1