File: __init__.py

package info (click to toggle)
python-os-ken 3.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 21,280 kB
  • sloc: python: 100,620; erlang: 14,517; ansic: 594; sh: 338; makefile: 136
file content (26 lines) | stat: -rw-r--r-- 571 bytes parent folder | download | duplicates (5)
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
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