changeset 6 | bb7742f924d7 |
5:055f7dfb3e4f | 6:bb7742f924d7 |
---|---|
1 import sys |
|
2 import os.path |
|
3 |
|
4 |
|
5 def search_package(package_name): |
|
6 """Add package name to all paths in sys.path. |
|
7 |
|
8 This allows the program to be installed inside some package, |
|
9 but leave the imports as they are. |
|
10 |
|
11 Just add `search_package` before any imports. |
|
12 |
|
13 """ |
|
14 sys.path += [os.path.join(path, package_name) for path in sys.path] |
|
15 |