egl: fix python lib deprecation warning
authorEric Engestrom <eric.engestrom@intel.com>
Wed, 7 Nov 2018 13:07:09 +0000 (13:07 +0000)
committerEric Engestrom <eric.engestrom@intel.com>
Sun, 13 Jan 2019 13:59:08 +0000 (13:59 +0000)
  DeprecationWarning: the imp module is deprecated in favour of importlib

Instead of complicated logic, just import the file directly.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/egl/Makefile.am
src/egl/generate/gen_egl_dispatch.py
src/egl/meson.build

index 7269912d96f3d8818892ebb484000ebad1375134..ff928525e6ce257c3a7511819089cfe56be11e4d 100644 (file)
@@ -143,13 +143,11 @@ GLVND_GEN_DEPS = generate/gen_egl_dispatch.py \
 PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
 g_egldispatchstubs.c: $(GLVND_GEN_DEPS)
        $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py source \
 PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
 g_egldispatchstubs.c: $(GLVND_GEN_DEPS)
        $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py source \
-               $(top_srcdir)/src/egl/generate/eglFunctionList.py \
                $(top_srcdir)/src/egl/generate/egl.xml \
                $(top_srcdir)/src/egl/generate/egl_other.xml > $@
 
 g_egldispatchstubs.h: $(GLVND_GEN_DEPS)
        $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py header \
                $(top_srcdir)/src/egl/generate/egl.xml \
                $(top_srcdir)/src/egl/generate/egl_other.xml > $@
 
 g_egldispatchstubs.h: $(GLVND_GEN_DEPS)
        $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py header \
-               $(top_srcdir)/src/egl/generate/eglFunctionList.py \
                $(top_srcdir)/src/egl/generate/egl.xml \
                $(top_srcdir)/src/egl/generate/egl_other.xml > $@
 
                $(top_srcdir)/src/egl/generate/egl.xml \
                $(top_srcdir)/src/egl/generate/egl_other.xml > $@
 
index eeb3f3f9a5a2051b958598c1c699455075b424df..d556a7782c9438f416213ca5e99b5f66eda8c2fe 100644 (file)
@@ -34,7 +34,7 @@ additional information defined in the module eglFunctionList.
 
 import argparse
 import collections
 
 import argparse
 import collections
-import imp
+import eglFunctionList
 import sys
 import textwrap
 
 import sys
 import textwrap
 
@@ -44,15 +44,10 @@ def main():
     parser = argparse.ArgumentParser()
     parser.add_argument("target", choices=("header", "source"),
             help="Whether to build the source or header file.")
     parser = argparse.ArgumentParser()
     parser.add_argument("target", choices=("header", "source"),
             help="Whether to build the source or header file.")
-    parser.add_argument("func_list_file", help="The function list .py file.")
     parser.add_argument("xml_files", nargs="+", help="The XML files with the EGL function lists.")
 
     args = parser.parse_args()
 
     parser.add_argument("xml_files", nargs="+", help="The XML files with the EGL function lists.")
 
     args = parser.parse_args()
 
-    # The function list is a Python module, but it's specified on the command
-    # line.
-    eglFunctionList = imp.load_source("eglFunctionList", args.func_list_file)
-
     xmlFunctions = genCommon.getFunctions(args.xml_files)
     xmlByName = dict((f.name, f) for f in xmlFunctions)
     functions = []
     xmlFunctions = genCommon.getFunctions(args.xml_files)
     xmlByName = dict((f.name, f) for f in xmlFunctions)
     functions = []
index 89bac2cd63347504120d277abe35ce28e8344974..461892f5ae8c02c9bef529ae1f96cfc041f9172f 100644 (file)
@@ -62,28 +62,28 @@ files_egl = files(
 g_egldispatchstubs_c = custom_target(
   'g_egldispatchstubs.c',
   input : [
 g_egldispatchstubs_c = custom_target(
   'g_egldispatchstubs.c',
   input : [
-    'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py',
+    'generate/gen_egl_dispatch.py',
     'generate/egl.xml', 'generate/egl_other.xml'
   ],
   output : 'g_egldispatchstubs.c',
   command : [
     'generate/egl.xml', 'generate/egl_other.xml'
   ],
   output : 'g_egldispatchstubs.c',
   command : [
-    prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@', '@INPUT3@'
+    prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@',
   ],
   ],
-  depend_files : files('generate/genCommon.py'),
+  depend_files : files('generate/eglFunctionList.py', 'generate/genCommon.py'),
   capture : true,
 )
 
 g_egldispatchstubs_h = custom_target(
   'g_egldispatchstubs.h',
   input : [
   capture : true,
 )
 
 g_egldispatchstubs_h = custom_target(
   'g_egldispatchstubs.h',
   input : [
-    'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py',
+    'generate/gen_egl_dispatch.py',
     'generate/egl.xml', 'generate/egl_other.xml'
   ],
   output : 'g_egldispatchstubs.h',
   command : [
     'generate/egl.xml', 'generate/egl_other.xml'
   ],
   output : 'g_egldispatchstubs.h',
   command : [
-    prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@', '@INPUT3@'
+    prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@',
   ],
   ],
-  depend_files : files('generate/genCommon.py'),
+  depend_files : files('generate/eglFunctionList.py', 'generate/genCommon.py'),
   capture : true,
 )
 
   capture : true,
 )