Skip to content

Commit

Permalink
allow multiple directory trees to be collected in a single json file;…
Browse files Browse the repository at this point in the history
… create wq shell command
  • Loading branch information
sheppard committed May 24, 2012
1 parent cd97663 commit f988949
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Empty file added __init__.py
Empty file.
Empty file added util/__init__.py
Empty file.
7 changes: 4 additions & 3 deletions util/build.py
Expand Up @@ -76,11 +76,12 @@ def _collectjson(conf, indir, noremap):
obj = {}
cur = os.getcwd()
os.chdir(indir)
for path, dirs, files in os.walk(conf['directory']):
for d in conf['paths']:
for path, dirs, files in os.walk(d):
if '.svn' in dirs:
dirs.remove('.svn')
o = obj
if path == conf['directory']:
if path == d:
path = ""
else:
apath = path.split('/')[1:]
Expand All @@ -98,7 +99,7 @@ def _collectjson(conf, indir, noremap):
fpath = None

if fpath is not None:
data = open(conf['directory'] + '/' + fpath + '.' + conf['type'])
data = open(d + '/' + fpath + '.' + conf['type'])
if conf['type'] == "json":
o[name] = json.load(data)
else:
Expand Down
14 changes: 14 additions & 0 deletions util/wq
@@ -0,0 +1,14 @@
#!/usr/bin/python
import sys
from wq.app.util.build import build

if __name__ == "__main__":
cmd = sys.argv[1] if len(sys.argv) > 1 else ""
if len(sys.argv) > 2:
args = sys.argv[2:]
else:
args = []
if cmd == "build":
build(*args)
else:
print "Usage: wq build [version] [configfile]"

0 comments on commit f988949

Please sign in to comment.