avoid generating python bytecode
authorAndrea Righi <andrea.righi@canonical.com>
Fri, 7 Jul 2023 08:44:25 +0000 (10:44 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 11 Dec 2023 10:00:49 +0000 (11:00 +0100)
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 <andrea.righi@canonical.com>
kconfig/run.py
kconfig/sanitize.py
setup.cfg

index fc7485e06efb6c06bcf062db1754bf8cccbe7702..27431d5cc442938edb5c378d9af4ff9982c39b51 100644 (file)
@@ -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:
index c39328401964259840222e3011efca32cc6fafc3..1aa962cbe88c7eb4406c80d75b268033d931ffed 100755 (executable)
@@ -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
index 7fc88b31ca0b56653f972fb1d94d7813fe798b8f..91700f5e87dbe3bc52870c328f4969821ca2f6fd 100644 (file)
--- 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]