diff options
author | Jan Vcelak <jan.vcelak@nic.cz> | 2013-03-22 13:27:01 +0100 |
---|---|---|
committer | Jan Vcelak <jan.vcelak@nic.cz> | 2013-03-22 13:27:21 +0100 |
commit | 9ca20749a56bbac3956caadf2400cfd3042af613 (patch) | |
tree | 2982d1e0755b6b59b56956a139ee9a71a508dde1 /scripts | |
parent | log: fix OpenBSD warning (insecure function) (diff) | |
download | knot-9ca20749a56bbac3956caadf2400cfd3042af613.tar.xz knot-9ca20749a56bbac3956caadf2400cfd3042af613.zip |
add script to generate QtCreator project file list
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/update-project-files.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/update-project-files.py b/scripts/update-project-files.py new file mode 100755 index 000000000..ad077b942 --- /dev/null +++ b/scripts/update-project-files.py @@ -0,0 +1,44 @@ +#!/usr/bin/python -Es +# vim: et:sw=4:ts=4:sts=4 +# +# Script regenerates project file list from the list of files tracked by Git. +# + +SOURCES = [ + # documentation + "README", "KNOWN_ISSUES", "CodingStyle", + "Doxyfile*", "Doxy.file.h", "doc/*.texi", + + # build-system + "*.ac", "*.am", "Makefile", + + # sources + "src/*.c", "src/*.h", +] + +OUTPUT_FILE = "Knot.files" + +# ---------------------------------------------------------------------------- + +from subprocess import Popen, PIPE +import os +import sys + +def run(command): + p = Popen(command, stdout=PIPE, stderr=PIPE) + (out, errout) = p.communicate() + if p.returncode != 0: + raise Exception("Command %s failed.", command) + return out + +print >>sys.stderr, "Updating %s." % OUTPUT_FILE + +git_root = run(["git", "rev-parse", "--show-toplevel"]).strip() +os.chdir(git_root) + +command = ["git", "ls-files"] + SOURCES +files = run(command).splitlines() + +with open(OUTPUT_FILE, "w") as output: + output.write("\n".join(sorted(files))) + output.write("\n") |