2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

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

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):