mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-30 15:15:38 +01:00
Introduced ninja tidy
This commit is contained in:
parent
4ee8ec68b0
commit
e3d423b32b
@ -709,6 +709,11 @@ def save_subninja_file(path_module):
|
||||
" description = Cleaning module {0}".format(path_module.rel),
|
||||
""]
|
||||
|
||||
l_string += ["rule make_tidy",
|
||||
" command = module_handler.py tidy {0}".format(path_module.rel),
|
||||
" description = Cleaning module {0}".format(path_module.rel),
|
||||
""]
|
||||
|
||||
l_string += ["rule executables",
|
||||
" command = make -C {0} executables .gitignore qp_edit.native qp_run.native".format(join("$QP_ROOT","ocaml")),
|
||||
" description = Updating OCaml executables",
|
||||
@ -719,6 +724,7 @@ def save_subninja_file(path_module):
|
||||
"build local: make_local_binaries dummy_target", "",
|
||||
"build executables: executables local dummy_target", "",
|
||||
"default executables", "", "build clean: make_clean dummy_target",
|
||||
"", "build tidy: make_tidy dummy_target",
|
||||
""]
|
||||
|
||||
path_ninja_cur = join(path_module.abs, "build.ninja")
|
||||
@ -745,6 +751,10 @@ def create_build_ninja_global():
|
||||
" command = module_handler.py clean --all",
|
||||
" description = Cleaning all modules", ""]
|
||||
|
||||
l_string += ["rule make_tidy",
|
||||
" command = module_handler.py tidy --all",
|
||||
" description = Cleaning all modules", ""]
|
||||
|
||||
l_string += ["rule make_ocaml",
|
||||
" command = make -C {0}/ocaml".format("$QP_ROOT"),
|
||||
" pool = console",
|
||||
@ -759,6 +769,8 @@ def create_build_ninja_global():
|
||||
"default ocaml_target",
|
||||
"",
|
||||
"build clean: make_clean dummy_target",
|
||||
"",
|
||||
"build tidy: make_tidy dummy_target",
|
||||
"", ]
|
||||
|
||||
path_ninja_cur = join(QP_ROOT, "build.ninja")
|
||||
|
@ -6,10 +6,13 @@ Module utilitary
|
||||
Usage:
|
||||
module_handler.py print_descendant [<module_name>...]
|
||||
module_handler.py clean [ --all | <module_name>...]
|
||||
module_handler.py create_git_ignore [<module_name>...]
|
||||
module_handler.py tidy [ --all | <module_name>...]
|
||||
|
||||
Options:
|
||||
print_descendant Print the genealogy of the needed modules
|
||||
clean Used for ninja clean
|
||||
tidy A light version of clean, where only the intermediate
|
||||
files are removed
|
||||
NEED The path of NEED file.
|
||||
by default try to open the file in the current path
|
||||
"""
|
||||
@ -230,7 +233,7 @@ if __name__ == '__main__':
|
||||
for module in l_module:
|
||||
print(" ".join(sorted(m.l_descendant_unique([module]))))
|
||||
|
||||
if arguments["clean"]:
|
||||
if arguments["clean"] or arguments["tidy"]:
|
||||
|
||||
l_dir = ['IRPF90_temp', 'IRPF90_man']
|
||||
l_file = ["irpf90_entities", "tags", "irpf90.make", "Makefile",
|
||||
@ -242,25 +245,25 @@ if __name__ == '__main__':
|
||||
l_symlink = m.l_descendant_unique([module])
|
||||
l_exe = get_binaries(module_abs)
|
||||
|
||||
for f in l_dir:
|
||||
try:
|
||||
shutil.rmtree(os.path.join(module_abs, f))
|
||||
except:
|
||||
pass
|
||||
|
||||
for symlink in l_symlink:
|
||||
try:
|
||||
os.unlink(os.path.join(module_abs, symlink))
|
||||
except:
|
||||
pass
|
||||
|
||||
for f in l_file:
|
||||
try:
|
||||
os.remove(os.path.join(module_abs, f))
|
||||
except:
|
||||
pass
|
||||
|
||||
if arguments["clean"]:
|
||||
for f in l_dir:
|
||||
try:
|
||||
shutil.rmtree(os.path.join(module_abs, f))
|
||||
except:
|
||||
pass
|
||||
|
||||
for symlink in l_symlink:
|
||||
try:
|
||||
os.unlink(os.path.join(module_abs, symlink))
|
||||
except:
|
||||
pass
|
||||
|
||||
for f in l_file:
|
||||
try:
|
||||
os.remove(os.path.join(module_abs, f))
|
||||
except:
|
||||
pass
|
||||
|
||||
for f in l_exe:
|
||||
|
||||
try:
|
||||
@ -268,6 +271,4 @@ if __name__ == '__main__':
|
||||
except:
|
||||
pass
|
||||
|
||||
if arguments["create_git_ignore"]:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user