os-ken/ryu/contrib/__init__.py
Jason Kölker 8d2604ee67 contrib/ovs: Remove embeded ovs, use upstream
Signed-off-by: Jason Kölker <jason@koelker.net>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-03-21 19:28:32 +09:00

27 lines
571 B
Python

import sys
_orig_sys_path = None
def update_module_path():
# Adjust module loading path for third party libraries
import os
global _orig_sys_path
_orig_sys_path = sys.path[:]
for path in __path__:
if path in sys.path:
sys.path.remove(path)
path = os.path.abspath(path)
if path in sys.path:
sys.path.remove(path)
sys.path.insert(0, path) # prioritize our own copy than system's
def restore_module_path():
global _orig_sys_path
sys.path = _orig_sys_path
_orig_sys_path = None