diff options
| author | Scott Bahling <sbahling@suse.de> | 2013-09-23 15:34:24 +0200 |
|---|---|---|
| committer | Scott Bahling <sbahling@suse.de> | 2013-09-23 15:34:24 +0200 |
| commit | a3065a8582c97035b5f5c0c0545d1836757a5b58 (patch) | |
| tree | 50f4c8f3dfa232a759f77ddd6ea7ad8cf30dc56b /panfry | |
| parent | 34af3c2702b337df96a8b01f77c6ae6fe2f2d80f (diff) | |
| download | panfry-a3065a8582c97035b5f5c0c0545d1836757a5b58.tar.gz panfry-a3065a8582c97035b5f5c0c0545d1836757a5b58.tar.xz panfry-a3065a8582c97035b5f5c0c0545d1836757a5b58.zip | |
Better handling of INDEXs
Diffstat (limited to 'panfry')
| -rwxr-xr-x | panfry/main.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/panfry/main.py b/panfry/main.py index 1b90181..917ebc0 100755 --- a/panfry/main.py +++ b/panfry/main.py @@ -33,13 +33,20 @@ class StoppableHttpServer(BaseHTTPServer.HTTPServer): self.handle_request() +def get_INDEX(path, index): + INDEX = os.path.join('src', path, 'INDEX') + if os.path.isfile(INDEX): + for line in open(INDEX, 'r').readlines(): + newpath = os.path.join(path, line.strip()) + index = get_INDEX(newpath, index) + index.append(newpath) + return index + def get_env(): env = panfry.cli.init_argparser().parse_args() env.pub_path = os.path.abspath(env.pub_path) - env.index = [''] if env.cmd in ['gen']: - INDEX = os.path.join(env.doc_path, 'src', 'INDEX') if not os.path.isdir(env.doc_path): print("%s directory not found. Aborting..." % env.doc_path) exit(1) @@ -54,8 +61,8 @@ def get_env(): if env.pandoc_options: env.pandoc_options = list(shlex.split(env.pandoc_options)) - if os.path.isfile(INDEX): - env.index += open(INDEX, 'r').readlines() + env.index = [''] + env.index = get_INDEX('', env.index) return env |
