forked from M-Labs/artiq
1
0
Fork 0

tools/file_import: use python 3.4 importlib API

This commit is contained in:
Sebastien Bourdeauducq 2015-02-17 13:07:09 -07:00
parent 4558fb3e33
commit 614a96a3d7
1 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,5 @@
from operator import itemgetter
import sys
import importlib.machinery
import linecache
import logging
@ -27,7 +28,9 @@ def file_import(filename):
modname = "file_import_" + modname
loader = importlib.machinery.SourceFileLoader(modname, filename)
return loader.load_module()
module = type(sys)(modname)
loader.exec_module(module)
return module
def verbosity_args(parser):