aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-02-12 12:21:01 -0800
committerOle Trøan <otroan@employees.org>2019-02-18 21:56:06 +0000
commitf4647ed885c47a72d94dd63e0903b6c1ae649813 (patch)
treebd82d6e6393b3c0cbf72eb198193947ba9698e39
parent222e1f4160a5828bb2b5bf62716cd76664f6100b (diff)
Resolve vppapigen DeprecationWarning.
/vpp/src/tools/vppapigen/vppapigen:823: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses Change-Id: If7729778374e9193f6381c8bd2ed34c875db3f1e Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rwxr-xr-xsrc/tools/vppapigen/vppapigen.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tools/vppapigen/vppapigen.py b/src/tools/vppapigen/vppapigen.py
index 431a9dc7f93..c2f221b9e79 100755
--- a/src/tools/vppapigen/vppapigen.py
+++ b/src/tools/vppapigen/vppapigen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
from __future__ import print_function
import ply.lex as lex
@@ -165,10 +165,10 @@ class Using():
self.name = name
if isinstance(alias, Array):
- a = { 'type': alias.fieldtype,
- 'length': alias.length }
+ a = { 'type': alias.fieldtype, # noqa: E201
+ 'length': alias.length } # noqa: E202
else:
- a = { 'type': alias.fieldtype }
+ a = { 'type': alias.fieldtype } # noqa: E201,E202
self.alias = a
self.crc = binascii.crc32(str(alias).encode()) & 0xffffffff
global_crc = binascii.crc32(str(alias).encode(), global_crc)
@@ -820,7 +820,7 @@ def main():
#
# Generate representation
#
- import imp
+ from importlib.machinery import SourceFileLoader
# Default path
pluginpath = ''
@@ -843,7 +843,8 @@ def main():
args.output_module.lower())
try:
- plugin = imp.load_source(args.output_module, module_path)
+ plugin = SourceFileLoader(args.output_module,
+ module_path).load_module()
except Exception as err:
raise Exception('Error importing output plugin: {}, {}'
.format(module_path, err))