[Mesa-dev] [PATCH mesa 2/3] egl: fix python lib deprecation warning

Eric Engestrom eric.engestrom at intel.com
Wed Nov 7 13:20:21 UTC 2018


  DeprecationWarning: the imp module is deprecated in favour of importlib

importlib is available since python 2.7 and 3.1, and we already require
2.7 and 3.4 so we can simply use the new lib.

Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
 src/egl/generate/gen_egl_dispatch.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/egl/generate/gen_egl_dispatch.py b/src/egl/generate/gen_egl_dispatch.py
index eeb3f3f9a5a2051b9585..0c4d2956eff28911336c 100644
--- a/src/egl/generate/gen_egl_dispatch.py
+++ b/src/egl/generate/gen_egl_dispatch.py
@@ -34,7 +34,7 @@
 
 import argparse
 import collections
-import imp
+import importlib.machinery
 import sys
 import textwrap
 
@@ -51,7 +51,7 @@ def main():
 
     # The function list is a Python module, but it's specified on the command
     # line.
-    eglFunctionList = imp.load_source("eglFunctionList", args.func_list_file)
+    eglFunctionList = importlib.machinery.SourceFileLoader("eglFunctionList", args.func_list_file).load_module()
 
     xmlFunctions = genCommon.getFunctions(args.xml_files)
     xmlByName = dict((f.name, f) for f in xmlFunctions)
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list