mirror of https://github.com/m-labs/artiq.git
Revert "tools/file_import: restore sys.modules. Closes #976"
This reverts commit 5f3e417bb5
.
This commit is contained in:
parent
5f3e417bb5
commit
b84a2a1eeb
|
@ -7,7 +7,6 @@ import os
|
|||
import atexit
|
||||
import string
|
||||
import random
|
||||
from copy import copy
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
@ -86,12 +85,8 @@ def file_import(filename, prefix="file_import_"):
|
|||
path = os.path.dirname(os.path.realpath(filename))
|
||||
sys.path.insert(0, path)
|
||||
try:
|
||||
previous_modules = copy(sys.modules)
|
||||
try:
|
||||
loader = importlib.machinery.SourceFileLoader(modname, filename)
|
||||
module = loader.load_module()
|
||||
finally:
|
||||
sys.modules = previous_modules
|
||||
loader = importlib.machinery.SourceFileLoader(modname, filename)
|
||||
module = loader.load_module()
|
||||
finally:
|
||||
sys.path.remove(path)
|
||||
|
||||
|
|
Loading…
Reference in New Issue