diff options
author | Donald Stufft <donald@stufft.io> | 2013-06-08 20:57:28 -0400 |
---|---|---|
committer | Donald Stufft <donald@stufft.io> | 2013-06-08 20:57:28 -0400 |
commit | c0dfceb5fe01857805ebb2bf72416a74b80bead3 (patch) | |
tree | 6c398c8c1cbb0ac8d4de667b94460506504c9d8a /pypi.wsgi | |
parent | b01a40d8fcb814118d5ed13882f3f1ad907afb67 (diff) | |
download | decorator-c0dfceb5fe01857805ebb2bf72416a74b80bead3.tar.gz |
Support different config.ini locations
Diffstat (limited to 'pypi.wsgi')
-rw-r--r-- | pypi.wsgi | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -21,7 +21,21 @@ from functools import partial store.keep_conn = True -CONFIG_FILE = os.path.join(PREFIX, "config.ini") + +def find_nearest(directory, search): + directory = os.path.abspath(directory) + parts = directory.split(os.path.sep) + for idx in xrange(len(parts)): + d = os.path.sep.join(parts[:-idx]) + if not d: + d = os.path.sep.join(parts) + s = os.path.join(d, search) + if os.path.isdir(s) or os.path.isfile(s): + return d + raise OSError + + +CONFIG_FILE = os.path.join(find_nearest(PREFIX, "config.ini"), "config.ini") class Request: |