aboutsummaryrefslogtreecommitdiff
path: root/buildtools/wrap-tree.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2013-02-04 05:31:03 +0000
committerRob Austein <sra@hactrn.net>2013-02-04 05:31:03 +0000
commitf6902e5ab90e8927b01dbb102270e7bf8386cefa (patch)
tree77485fbb38d0af4d4f133660a02bb43b02539551 /buildtools/wrap-tree.py
parentcb3c0c95b314dcc3f4c8a18f095ab8828833466b (diff)
Allow naming tree(s) on command line.
svn path=/branches/tk377/; revision=5024
Diffstat (limited to 'buildtools/wrap-tree.py')
-rw-r--r--buildtools/wrap-tree.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/buildtools/wrap-tree.py b/buildtools/wrap-tree.py
index 5aa1c8bc..2123b79b 100644
--- a/buildtools/wrap-tree.py
+++ b/buildtools/wrap-tree.py
@@ -26,14 +26,17 @@ import sys
result = {}
-for root, dirs, files in os.walk("."):
- for dn in dirs:
- dn = os.path.relpath(os.path.join(root, dn))
- result[dn] = None
- for fn in files:
- fn = os.path.relpath(os.path.join(root, fn))
- with open(fn, "r") as f:
- result[fn] = f.read()
+for root in sys.argv[1:] or ["."]:
+ if root != ".":
+ result[root] = None
+ for dirpath, dirs, files in os.walk(root):
+ for dn in dirs:
+ dn = os.path.relpath(os.path.join(dirpath, dn))
+ result[dn] = None
+ for fn in files:
+ fn = os.path.relpath(os.path.join(dirpath, fn))
+ with open(fn, "r") as f:
+ result[fn] = f.read()
sys.stdout.write("# Automatically generated. Hack if you like, but beware of overwriting.\n\nimport os\n")