aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-12-20 13:12:19 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-12-20 14:26:44 +0000
commit16905976c82c57fdc98a8988392354597f166a12 (patch)
tree8e8c677a793f10bdc93594c071f46721a1880f1e /scripts
parent335a259da22a1775fad3f3b83cc31cbcf7d1afcc (diff)
downloadYAGE-16905976c82c57fdc98a8988392354597f166a12.tar.gz
YAGE-16905976c82c57fdc98a8988392354597f166a12.zip
improving compilation speed
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/add_version_headers17
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/add_version_headers b/scripts/add_version_headers
index c4fd3ffc..c3b26566 100755
--- a/scripts/add_version_headers
+++ b/scripts/add_version_headers
@@ -24,10 +24,12 @@ import os
import re
import sys
+from subprocess import call
-header = """/* ---------------------------------------------------------------\
--------------
- * {0}
+
+header = """/** ---------------------------------------------------------------\
+------------
+ * @file: {0}
*
* Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
* MIT License, see LICENSE file for more details.
@@ -38,7 +40,7 @@ header = """/* ---------------------------------------------------------------\
lic_regex = re.compile(
- "\/\* -+\n \* ([a-z]+\.(?:cpp|h)|\{0\})\n(?: \*[ a-zA-Z0-9_.,\-()<>@]*\n)+ \* -+\n \*/", re.MULTILINE)
+ "\/(?:\*|\*\*) -+\n \* ((?:@file: )?[a-z]+\.(?:cpp|h)|\{0\})\n(?: \*[ a-zA-Z0-9_.,\-()<>@]*\n)+ \* -+\n \*/", re.MULTILINE)
class HeaderUpdate(object):
@@ -102,12 +104,19 @@ class HeaderUpdate(object):
not re.match(self.exclude_re, fileName)):
fileOperation(os.path.join(subdir, fileName))
+ def runClangFormat(self):
+ def clangFormatFileOpration(filePath):
+ call(["clang-format", "-i", filePath])
+
+ self._traverseDir(self.starting_dir, clangFormatFileOpration)
+
def main(argv):
update = HeaderUpdate(exclude_re="^picopng\.cpp",
match_dir=".*yage|.*tests",
exclude_dir=".*lib.*|.*build.*")
update.updateHeader()
+ update.runClangFormat()
if __name__ == "__main__":