diff options
author | Alberto Luaces Fernández <aluaces@udc.es> | 2015-05-13 19:45:06 +0100 |
---|---|---|
committer | Alberto Luaces Fernández <aluaces@udc.es> | 2015-05-13 19:45:06 +0100 |
commit | f4123b269fe5af6d04d68a643d16fea9fa388e2d (patch) | |
tree | 4361a69e833eaa18c49cad6bf594c9cddfcc6f89 /rename_add_contr.py |
Import yasnippet-snippets_0~git20150512.orig.tar.gz
[dgit import orig yasnippet-snippets_0~git20150512.orig.tar.gz]
Diffstat (limited to 'rename_add_contr.py')
-rwxr-xr-x | rename_add_contr.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/rename_add_contr.py b/rename_add_contr.py new file mode 100755 index 0000000..3ed7847 --- /dev/null +++ b/rename_add_contr.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +import os +import re +from os.path import join +from shutil import move + + +def rename(root, f): + if f.endswith('.yasnippet'): + base, _ = f.split('.') + print("move %s to %s" % (join(root, f), join(root, base))) + move(join(root, f), join(root, base)) + + +CONT = "# contributor: Andrea crotti\n# --" +END = "# --\n\n" + +orig = "# --\n\n" +to = "# --\n" + +def insert(root, f, orig, to): + fname = join(root, f) + text = open(fname).read() + nex_text = re.sub(orig, to, text) + open(fname, 'w').write(nex_text) + +if __name__ == '__main__': + for root, dirs, files in os.walk('.'): + if "mode" in root: + # os.popen("git add *yasnippet") + for f in files: + rename(root, f) + # insert(root, f, orig, to) + + + |