Fix: conf.py imp import deprecation warning 28/67828/2
authorGuillaume Lambert <guillaume.lambert@orange.com>
Thu, 27 May 2021 19:16:03 +0000 (21:16 +0200)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Thu, 27 May 2021 19:26:05 +0000 (21:26 +0200)
According to https://docs.python.org/3/library/imp.html imp is
deprecated in favor of importlib since python 3.4 and imp.find_module
must be replaced by importlib.util.find_spec()

Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: If3acf1b9aac6092a7a982598453d586316276dff

docs_conf/conf.py

index 0a62067..a2a7f2c 100644 (file)
@@ -15,7 +15,7 @@ Configure sphinx-doc through an YAML file.
 """
 
 import datetime
-import imp
+import importlib
 import os.path
 
 import sphinx_bootstrap_theme
@@ -53,7 +53,7 @@ def collect_project_and_config():
 
     project_cfg = local_config.get("project_cfg", None)
 
-    _, docs_path, _ = imp.find_module("docs_conf")
+    docs_path = importlib.util.find_spec("docs_conf").submodule_search_locations[0]
 
     default_cfg = os.path.join(docs_path, "defaults", "default.yaml")
     with open(os.path.join(docs_path, default_cfg), "r") as f: