On 11/07/2018 06:20 AM, Eric Engestrom wrote:
   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.engest...@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)
I think importlib.machinery.SourceFileLoader is only available starting with Python 3.3, so the script would break if you tried to run it with Python 2.

For what it's worth, though, loading the eglFunctionList module dynamically like that was originally intended just to make it easier for a vendor library to use the gen_egl_dispatch.py script from libglvnd, but with its own function list. In Mesa's case, just a simple "import eglFunctionList" would probably work just as well.

-Kyle

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to