home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.4)
-
- _packs = { }
-
- def addpack(pack, *locations):
- import os
- if os.path.isabs(pack):
- base = os.path.basename(pack)
- else:
- base = pack
- if _packs.has_key(base):
- return None
-
- import sys
- path = []
- for loc in _flatten(locations) + sys.path:
- fn = os.path.join(loc, base)
- if fn not in path and os.path.isdir(fn):
- path.append(fn)
- continue
-
- if pack != base and pack not in path and os.path.isdir(pack):
- path.append(pack)
-
- if not path:
- raise ImportError, 'package ' + pack + ' not found'
-
- _packs[base] = path
- for fn in path:
- if fn not in sys.path:
- sys.path.append(fn)
- continue
-
-
-
- def _flatten(locations):
- locs = []
- for loc in locations:
- if type(loc) == type(''):
- locs.append(loc)
- continue
- locs = locs + _flatten(loc)
-
- return locs
-
-