mirror of https://github.com/m-labs/artiq.git
tools/file_import: use python 3.4 importlib API
This commit is contained in:
parent
4558fb3e33
commit
614a96a3d7
|
@ -1,4 +1,5 @@
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
import sys
|
||||||
import importlib.machinery
|
import importlib.machinery
|
||||||
import linecache
|
import linecache
|
||||||
import logging
|
import logging
|
||||||
|
@ -27,7 +28,9 @@ def file_import(filename):
|
||||||
modname = "file_import_" + modname
|
modname = "file_import_" + modname
|
||||||
|
|
||||||
loader = importlib.machinery.SourceFileLoader(modname, filename)
|
loader = importlib.machinery.SourceFileLoader(modname, filename)
|
||||||
return loader.load_module()
|
module = type(sys)(modname)
|
||||||
|
loader.exec_module(module)
|
||||||
|
return module
|
||||||
|
|
||||||
|
|
||||||
def verbosity_args(parser):
|
def verbosity_args(parser):
|
||||||
|
|
Loading…
Reference in New Issue