aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gizak/termui/config.py
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-01-11 02:33:17 +0800
committerFelix Lange <fjl@twurst.com>2017-01-11 05:33:24 +0800
commitd78f9b834ade0f1ebcf2532bf90d01c85ad50a8e (patch)
treedd03906433e1032a0b185910773206246d8a1556 /vendor/github.com/gizak/termui/config.py
parent02b67558e8eaa7b34a28b8dd0223824bbbb52349 (diff)
downloadgo-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.tar.gz
go-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.tar.zst
go-tangerine-d78f9b834ade0f1ebcf2532bf90d01c85ad50a8e.zip
vendor: update all dependencies except Azure SDK
The Azure SDK doesn't support Go 1.5 anymore. We can't upgrade it until Go 1.8 comes out.
Diffstat (limited to 'vendor/github.com/gizak/termui/config.py')
-rw-r--r--vendor/github.com/gizak/termui/config.py79
1 files changed, 79 insertions, 0 deletions
diff --git a/vendor/github.com/gizak/termui/config.py b/vendor/github.com/gizak/termui/config.py
new file mode 100644
index 000000000..9152bf517
--- /dev/null
+++ b/vendor/github.com/gizak/termui/config.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python3
+
+# use v6;
+#
+# my $copyright = '// Copyright 2016 Zack Guo <gizak@icloud.com>. All rights reserved.
+# // Use of this source code is governed by a MIT license that can
+# // be found in the LICENSE file.
+#
+# ';
+#
+# sub MAIN('update-docstr', Str $srcp) {
+# if $srcp.IO.f {
+# $_ = $srcp.IO.slurp;
+# if m/^ \/\/\s Copyright .+? \n\n/ {
+# unless ~$/ eq $copyright {
+# s/^ \/\/\s Copyright .+? \n\n /$copyright/;
+# spurt $srcp, $_;
+# say "[updated] doc string for:"~$srcp;
+# }
+# } else {
+# say "[added] doc string for "~$srcp~" (no match found)";
+# $_ = $copyright ~ $_;
+# spurt $srcp, $_;
+# }
+# }
+# }
+
+import re
+import os
+import io
+
+copyright = """// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
+// Use of this source code is governed by a MIT license that can
+// be found in the LICENSE file.
+
+"""
+
+exclude_dirs = [".git", "_docs"]
+exclude_files = []
+include_dirs = [".", "debug", "extra", "test", "_example"]
+
+
+def is_target(fpath):
+ if os.path.splitext(fpath)[-1] == ".go":
+ return True
+ return False
+
+
+def update_copyright(fpath):
+ print("processing " + fpath)
+ f = io.open(fpath, 'r', encoding='utf-8')
+ fstr = f.read()
+ f.close()
+
+ # remove old
+ m = re.search('^// Copyright .+?\r?\n\r?\n', fstr, re.MULTILINE|re.DOTALL)
+ if m:
+ fstr = fstr[m.end():]
+
+ # add new
+ fstr = copyright + fstr
+ f = io.open(fpath, 'w',encoding='utf-8')
+ f.write(fstr)
+ f.close()
+
+
+def main():
+ for d in include_dirs:
+ files = [
+ os.path.join(d, f) for f in os.listdir(d)
+ if os.path.isfile(os.path.join(d, f))
+ ]
+ for f in files:
+ if is_target(f):
+ update_copyright(f)
+
+
+if __name__ == '__main__':
+ main()