diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/Copyrighter.py | 96 | ||||
-rwxr-xr-x | tools/ThemeQRC.py | 17 |
2 files changed, 0 insertions, 113 deletions
diff --git a/tools/Copyrighter.py b/tools/Copyrighter.py deleted file mode 100755 index 189dcf5..0000000 --- a/tools/Copyrighter.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env python -#coding=utf-8 - -import os, re, datetime - -TEMPLATE = """/* - * Copyright (c) %(year)s %(author)s. - * See the included COPYING file for license details. - */ - -""" - -def updateCopyright(fileName) : - file = open(fileName) - fileData = "" - - author = "" - startYear = "" - endYear = "" - previousCopyright = "" - - # Retrieve previous copyright information - header = "" - inHeader = False - inSpaceBelowHeader = False - lines = file.readlines() - lines2 = lines - for line in lines2 : - lines.pop(0) - if inSpaceBelowHeader : - if line.strip() != "" : - break - elif inHeader : - if line.startswith(" */") : - inSpaceBelowHeader = True - else : - header += line - else : - if line.strip() == "" : - continue - elif line.startswith("/*") : - inHeader = True - header += line - else : - fileData += line - break - if "Copyright" in header : - previousCopyright = header - m = re.match("\* Copyright \(c\) (?P<startYear>\d\d\d\d)(-(?P<endYear>\d\d\d\d))? (?P<author>.*)", header) - if m : - author = m.group("author") - startYear = m.group("startYear") - endYear = m.group("endYear") - elif header != "" : - fileData = header - file.close() - - # Read in the rest of the data - fileData += "".join(lines) - - # Guess empty values - if author == "" : - if "Swift/" in fileName : - author = "Kevin Smith" - else : - author = u"Remko Tronçon" - if startYear == "" : - startYear = datetime.date.today().strftime("%Y") - elif endYear == "" : - ## TODO: Guess end year by looking at git log --pretty=format:%ai -- <filename> - pass - - # Generate a copyright - year = startYear + "-" + endYear if len(endYear) > 0 else startYear - copyright = TEMPLATE % { - "author" : author, - "year" : year - } - - # Write the copyright to the file - if copyright.encode("utf-8") != previousCopyright : - file = open(fileName, "w") - file.write(copyright.encode("utf-8")) - file.write(fileData) - file.close() - -for (path, dirs, files) in os.walk("Swiften/JID") : - if "3rdParty" in path : - continue - for filename in files : - if not filename.endswith(".cpp") and not filename.endswith(".h") : - continue - if filename.startswith("moc_") : - continue - fullFilename = path + "/" + filename - updateCopyright(fullFilename) diff --git a/tools/ThemeQRC.py b/tools/ThemeQRC.py deleted file mode 100755 index 63de8c3..0000000 --- a/tools/ThemeQRC.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python - -import os, sys, os.path - -print "<RCC version =\"1.0\">" -print "<qresource prefix=\"/themes/Default\">" -for (path, dirs, files) in os.walk(sys.argv[1]) : - for file in files : - filePath = os.path.join(path,file) - print "<file alias=\"%(alias)s\">%(path)s</file>" % { - "alias": filePath[len(sys.argv[1])+1:], - "path": filePath - } - -print "</qresource>" -print "</RCC>" - |