From 3ea31f5c869aa662792d84ff7438e915c4698c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu> Date: Thu, 4 Jul 2019 15:58:53 +0200 Subject: [PATCH] Replaed imp with importlib --- envsetup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/envsetup.py b/envsetup.py index 77048ac5..f66e4a91 100755 --- a/envsetup.py +++ b/envsetup.py @@ -3,7 +3,7 @@ ''' Environment setup script for MediaServer ''' -import imp +import importlib.util import os import subprocess import sys @@ -97,7 +97,9 @@ class EnvSetup(): continue if os.path.isfile(os.path.join(path, self.PY_SETUP_NAME)): - setup_module = imp.load_source('setup_%s' % name, os.path.join(path, self.PY_SETUP_NAME)) + spec = importlib.util.spec_from_file_location('setup_%s' % name, os.path.join(path, self.PY_SETUP_NAME)) + setup_module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(setup_module) actions.append(dict(index=index, label=label, path=path, fct=setup_module.setup)) elif os.path.isfile(os.path.join(path, self.BASH_SETUP_NAME)): actions.append(dict(index=index, label=label, path=path, fct='bash -e "%s"' % os.path.join(path, self.BASH_SETUP_NAME))) -- GitLab