forked from M-Labs/artiq
Revert "tools/file_import: use python 3.4 importlib API"
This reverts commit 614a96a3d7
.
Conflicts:
artiq/tools.py
This commit is contained in:
parent
e6d0fc2021
commit
3543dc30c7
|
@ -1,5 +1,4 @@
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
import sys
|
|
||||||
import importlib.machinery
|
import importlib.machinery
|
||||||
import linecache
|
import linecache
|
||||||
import logging
|
import logging
|
||||||
|
@ -32,8 +31,7 @@ def file_import(filename):
|
||||||
sys.path.insert(0, path)
|
sys.path.insert(0, path)
|
||||||
|
|
||||||
loader = importlib.machinery.SourceFileLoader(modname, filename)
|
loader = importlib.machinery.SourceFileLoader(modname, filename)
|
||||||
module = type(sys)(modname)
|
module = loader.load_module()
|
||||||
loader.exec_module(module)
|
|
||||||
|
|
||||||
sys.path.remove(path)
|
sys.path.remove(path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue