Mercurial > piecrust2
annotate piecrust/pathutil.py @ 35:e4c345dcf33c
More unit tests, fix a bug with the skip patterns.
| author | Ludovic Chabant <ludovic@chabant.com> |
|---|---|
| date | Wed, 20 Aug 2014 21:46:27 -0700 |
| parents | aaa8fb7c8918 |
| children | 485682a6de50 |
| rev | line source |
|---|---|
| 0 | 1 import os |
| 2 import os.path | |
| 3 | |
| 4 | |
| 5 class SiteNotFoundError(Exception): | |
| 6 def __init__(self, root=None): | |
| 7 if not root: | |
| 8 root = os.getcwd() | |
| 9 Exception.__init__(self, | |
| 10 "No PieCrust website in '%s' " | |
| 11 "('_content/config.yml' not found!)." % root) | |
| 12 | |
| 13 | |
| 14 def find_app_root(cwd=None): | |
| 15 if cwd is None: | |
| 16 cwd = os.getcwd() | |
| 17 | |
| 18 while not os.path.isfile(os.path.join(cwd, '_content', 'config.yml')): | |
| 19 cwd = os.path.dirname(cwd) | |
|
1
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
20 if not cwd or cwd == '/': |
| 0 | 21 return None |
| 22 return cwd | |
| 23 |
