From 3d4a0317d0ccc195cc4b53295b49edf7dbe3e32c Mon Sep 17 00:00:00 2001 From: toinux <26522723+itzwam@users.noreply.github.com> Date: Mon, 16 Oct 2023 17:52:49 +0100 Subject: [PATCH] Support PYCompiled Modules Signed-off-by: Antoine "toinux" LESIEUR <26522723+itzwam@users.noreply.github.com> --- ifupdown2/ifupdown/ifupdownmain.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ifupdown2/ifupdown/ifupdownmain.py b/ifupdown2/ifupdown/ifupdownmain.py index 51f54609..6a1ac12b 100644 --- a/ifupdown2/ifupdown/ifupdownmain.py +++ b/ifupdown2/ifupdown/ifupdownmain.py @@ -1433,6 +1433,10 @@ def load_addon_modules(self, modules_dir_list): if self.modules.get(mname): continue mpath = modules_dir + '/' + mname + '.py' + if not os.path.exists(mpath): + mpathc = modules_dir + '/' + mname + '.pyc' + if os.path.exists(mpathc): + mpath = mpathc if os.path.exists(mpath) and mpath not in failed_import: try: m = __import__(mname)