# HG changeset patch # User Radek Brich # Date 1373548835 -7200 # Node ID bb7742f924d77d0de3885800ce8fd9e3506fcdbf # Parent 055f7dfb3e4f7f52b196645b6bcd9715411bf851 Add search_package utility function. diff -r 055f7dfb3e4f -r bb7742f924d7 pycolib/syspath.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pycolib/syspath.py Thu Jul 11 15:20:35 2013 +0200 @@ -0,0 +1,15 @@ +import sys +import os.path + + +def search_package(package_name): + """Add package name to all paths in sys.path. + + This allows the program to be installed inside some package, + but leave the imports as they are. + + Just add `search_package` before any imports. + + """ + sys.path += [os.path.join(path, package_name) for path in sys.path] +