mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
Added some tools to manipulate source code in bulk
This commit is contained in:
parent
e9194f5c55
commit
b22257b610
3 changed files with 56 additions and 0 deletions
26
build_tools/apply_license.py
Normal file
26
build_tools/apply_license.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
rex = "@FILENAME@"
|
||||||
|
|
||||||
|
filename = sys.argv[1]
|
||||||
|
|
||||||
|
|
||||||
|
fh = file("header.txt")
|
||||||
|
header = fh.read()
|
||||||
|
header_translated = re.sub(r'@FILENAME@', filename, header)
|
||||||
|
fh.close()
|
||||||
|
|
||||||
|
f = file(filename)
|
||||||
|
lines = f.read()
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
lines = re.sub(r'(?s)/\*\+.*\+\*/','',lines)
|
||||||
|
lines = header_translated + lines
|
||||||
|
|
||||||
|
with tempfile.NamedTemporaryFile(delete=False) as tmp_sources:
|
||||||
|
tmp_sources.write(lines)
|
||||||
|
|
||||||
|
shutil.move(tmp_sources.name, filename)
|
11
build_tools/gather_sources.py
Normal file
11
build_tools/gather_sources.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from git import Repo
|
||||||
|
|
||||||
|
repo = Repo(".")
|
||||||
|
|
||||||
|
assert repo.bare == False
|
||||||
|
|
||||||
|
t = repo.tree()
|
||||||
|
|
||||||
|
|
||||||
|
for entry in t.travers():
|
||||||
|
print entry
|
19
build_tools/header.txt
Normal file
19
build_tools/header.txt
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*+
|
||||||
|
VIDE -- Void IDEntification pipeline -- @FILENAME@
|
||||||
|
Copyright (C) 2010-2013 Guilhem Lavaux
|
||||||
|
Copyright (C) 2011-2013 Paul M. Sutter
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
+*/
|
Loading…
Add table
Add a link
Reference in a new issue