diff options
author | Rob Austein <sra@hactrn.net> | 2013-03-14 18:50:16 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2013-03-14 18:50:16 +0000 |
commit | 93943765d3a6c4ade1ad2b118fc31cca546e7f6d (patch) | |
tree | ca5ff14165d63fe33a48582129dbb2da446b61ca /buildtools/wrap-tree.py | |
parent | 6062493d6849eb8f5f0dc365f86138814fc16853 (diff) |
Unpack silly debian-package-skeleton.py script, replace other
Debian-universe kludges with something simple that just copies a
debian/ skeleton tree and generates a debian/changelog file.
svn path=/trunk/; revision=5144
Diffstat (limited to 'buildtools/wrap-tree.py')
-rw-r--r-- | buildtools/wrap-tree.py | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/buildtools/wrap-tree.py b/buildtools/wrap-tree.py deleted file mode 100644 index 2123b79b..00000000 --- a/buildtools/wrap-tree.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Package a directory tree inside a Python script. This is mostly -useful when generating templates for small trees of files one wants to -generate automatically with some customizations (eg, the skeleton for -some the packaging files needed by some platform or another). - -$Id$ - -Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -""" - -import os -import sys - -result = {} - -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") - -for k in sorted(result): - v = result[k] - if v is None: - sys.stdout.write("\nos.makedirs(%r)\n" % k) - else: - sys.stdout.write("\nwith open(%r, \"wb\") as f:\n" % k) - lines = v.splitlines() - if v.endswith("\n"): - lines.append("") - sys.stdout.write(" f.write('''\\\n") - while lines: - words = lines.pop(0).replace("\\", "\\\\").split("'''") - sys.stdout.write(words[0]) - for word in words[1:]: - sys.stdout.write("''' + \"'''\" + '''") - sys.stdout.write(word) - if not lines: - sys.stdout.write("''')") - sys.stdout.write("\n") |