-
Notifications
You must be signed in to change notification settings - Fork 1
/
init_sfepy.py
31 lines (27 loc) · 1015 Bytes
/
init_sfepy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##
# Path and module setup.
# 18.01.2005
# 13.10.2005
import sys
import os.path as op
install_dir = op.dirname( __file__ )
##
# Taken from pyunit.
## import __builtin__
## class RollbackImporter:
## def __init__(self):
## "Creates an instance and installs as the global importer"
## self.previous_modules = sys.modules.copy()
## self.real_import = __builtin__.__import__
## __builtin__.__import__ = self._import
## self.new_modules = {}
## def _import(self, name, globals=None, locals=None, fromlist=[]):
## result = apply(self.real_import, (name, globals, locals, fromlist))
## self.new_modules[name] = 1
## return result
## def uninstall(self):
## for modname in self.new_modules.keys():
## if not self.previous_modules.has_key(modname):
## # Force reload when modname next imported
## del(sys.modules[modname])
## __builtin__.__import__ = self.real_import