mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-22 20:35:19 +01:00
Refortorisation of update_readme
This commit is contained in:
parent
5e98b8c2ae
commit
b97e337f4b
1
plugins/Full_CI/.gitignore
vendored
1
plugins/Full_CI/.gitignore
vendored
@ -22,7 +22,6 @@ Properties
|
||||
Pseudo
|
||||
Selectors_full
|
||||
Utils
|
||||
exc_degree
|
||||
ezfio_interface.irp.f
|
||||
full_ci
|
||||
full_ci_no_skip
|
||||
|
@ -4,10 +4,22 @@ Full_CI Module
|
||||
|
||||
Performs a perturbatively selected Full-CI.
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Perturbation <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation>`_
|
||||
* `Selectors_full <http://github.com/LCPQ/quantum_package/tree/master/src/Selectors_full>`_
|
||||
* `Generators_full <http://github.com/LCPQ/quantum_package/tree/master/src/Generators_full>`_
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`full_ci <http://github.com/LCPQ/quantum_package/tree/master/src/Full_CI/full_ci_no_skip.irp.f#L1>`_
|
||||
@ -153,15 +165,3 @@ Documentation
|
||||
`var_pt2_ratio_run <http://github.com/LCPQ/quantum_package/tree/master/src/Full_CI/var_pt2_ratio.irp.f#L1>`_
|
||||
Undocumented
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Perturbation <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation>`_
|
||||
* `Selectors_full <http://github.com/LCPQ/quantum_package/tree/master/src/Selectors_full>`_
|
||||
* `Generators_full <http://github.com/LCPQ/quantum_package/tree/master/src/Generators_full>`_
|
||||
|
||||
|
@ -5,10 +5,21 @@ Generators_full Module
|
||||
All the determinants of the wave function are generators. In this way, the Full CI
|
||||
space is explored.
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Determinants <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants>`_
|
||||
* `Hartree_Fock <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock>`_
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`degree_max_generators <http://github.com/LCPQ/quantum_package/tree/master/src/Generators_full/generators.irp.f#L43>`_
|
||||
@ -37,14 +48,3 @@ Documentation
|
||||
`size_select_max <http://github.com/LCPQ/quantum_package/tree/master/src/Generators_full/generators.irp.f#L58>`_
|
||||
Size of the select_max array
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Determinants <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants>`_
|
||||
* `Hartree_Fock <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock>`_
|
||||
|
||||
|
@ -7,7 +7,7 @@ From the 140 molecules of the G2 set, only LiO, ONa don't converge well.
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -18,7 +18,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`ao_bi_elec_integral_alpha <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/Fock_matrix.irp.f#L102>`_
|
||||
|
@ -67,10 +67,21 @@ Assumptions
|
||||
pt2_....
|
||||
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Properties <http://github.com/LCPQ/quantum_package/tree/master/src/Properties>`_
|
||||
* `Hartree_Fock <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock>`_
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`do_pt2_end <http://github.com/LCPQ/quantum_package/tree/master/src/Perturbation/ezfio_interface.irp.f#L6>`_
|
||||
@ -350,14 +361,3 @@ Documentation
|
||||
The selection process stops when the energy ratio variational/(variational+PT2)
|
||||
is equal to var_pt2_ratio
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Properties <http://github.com/LCPQ/quantum_package/tree/master/src/Properties>`_
|
||||
* `Hartree_Fock <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock>`_
|
||||
|
||||
|
@ -2,10 +2,20 @@
|
||||
Properties Module
|
||||
=================
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Determinants <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants>`_
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`ao_integrated_delta_rho_all_points <http://github.com/LCPQ/quantum_package/tree/master/src/Properties/delta_rho.irp.f#L61>`_
|
||||
@ -142,13 +152,3 @@ Documentation
|
||||
`z_one_point <http://github.com/LCPQ/quantum_package/tree/master/src/Properties/ezfio_interface.irp.f#L6>`_
|
||||
z point on which the integrated delta rho is calculated
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Determinants <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants>`_
|
||||
|
||||
|
@ -2,10 +2,21 @@
|
||||
Selectors_full Module
|
||||
=====================
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Determinants <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants>`_
|
||||
* `Hartree_Fock <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock>`_
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`coef_hf_selector <http://github.com/LCPQ/quantum_package/tree/master/src/Selectors_full/e_corr_selectors.irp.f#L28>`_
|
||||
@ -175,14 +186,3 @@ Documentation
|
||||
`psi_selectors_size <http://github.com/LCPQ/quantum_package/tree/master/src/Selectors_full/selectors.irp.f#L3>`_
|
||||
Undocumented
|
||||
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
|
||||
* `Determinants <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants>`_
|
||||
* `Hartree_Fock <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock>`_
|
||||
|
||||
|
@ -23,12 +23,11 @@ except ImportError:
|
||||
"..",
|
||||
"..",
|
||||
"quantum_package.rc"))
|
||||
print """
|
||||
Error:
|
||||
source %s
|
||||
""" % f
|
||||
|
||||
print "\n".join(["", "Error:", "source %s" % f, ""])
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# __
|
||||
# /__ | _ |_ _. | _. ._ o _. |_ | _ _
|
||||
# \_| | (_) |_) (_| | \/ (_| | | (_| |_) | (/_ _>
|
||||
@ -516,7 +515,7 @@ def ninja_readme_rule():
|
||||
For not dealted the readme when ninja -t clean and the generator option
|
||||
"""
|
||||
l_string = ["rule build_readme",
|
||||
" command = cd $module_abs ; update_README.py $module_root",
|
||||
" command = qp_update_readme.py $module_abs --root_module $module_root",
|
||||
" description = update_README $module_rel",
|
||||
" generator = 1", ""]
|
||||
|
||||
@ -552,7 +551,8 @@ def ninja_readme_build(path_module, d_irp, dict_root_path):
|
||||
# /
|
||||
def get_binaries(path_module):
|
||||
"""
|
||||
Return the list of binaries (Path= namedtuple('Path', ['abs', 'rel']) for a module
|
||||
Return the list of binaries
|
||||
(Path= namedtuple('Path', ['abs', 'rel']) for a module
|
||||
"""
|
||||
import subprocess
|
||||
|
||||
@ -729,7 +729,7 @@ def ninja_dot_tree_build(path_module, l_module):
|
||||
# |\/| _ _| | _
|
||||
# | | (_) (_| |_| | (/_
|
||||
#
|
||||
def create_build_ninja_module(path_module):
|
||||
def save_subninja_file(path_module):
|
||||
l_string = ["builddir = {0}".format(os.path.dirname(ROOT_BUILD_NINJA)),
|
||||
""]
|
||||
|
||||
@ -929,9 +929,6 @@ if __name__ == "__main__":
|
||||
|
||||
for module_to_compile in l_module:
|
||||
|
||||
if arguments["--development"]:
|
||||
create_build_ninja_module(module_to_compile)
|
||||
|
||||
# ~#~#~#~#~#~#~#~ #
|
||||
# S y m l i n k #
|
||||
# ~#~#~#~#~#~#~#~ #
|
||||
@ -946,19 +943,18 @@ if __name__ == "__main__":
|
||||
l_string += ninja_irpf90_make_build(module_to_compile, l_children,
|
||||
d_irp)
|
||||
|
||||
if arguments["--development"]:
|
||||
l_string += ninja_binaries_build(module_to_compile, l_children,
|
||||
d_binaries)
|
||||
l_string += ninja_binaries_build(module_to_compile, l_children,
|
||||
d_binaries)
|
||||
|
||||
elif arguments["--production"]:
|
||||
l_string += ninja_binaries_build(module_to_compile, l_children,
|
||||
d_binaries)
|
||||
if arguments["--development"]:
|
||||
|
||||
l_string += ninja_module_build(module_to_compile, d_binaries)
|
||||
|
||||
l_string += ninja_gitignore_build(module_to_compile, d_binaries,
|
||||
l_symlink)
|
||||
|
||||
save_subninja_file(module_to_compile)
|
||||
|
||||
# ~#~#~#~#~ #
|
||||
# S a v e s #
|
||||
# ~#~#~#~#~ #
|
||||
|
@ -30,7 +30,6 @@ except ImportError:
|
||||
raise
|
||||
|
||||
|
||||
# Canot cache for namedtuple are not hashable
|
||||
def is_module(path_module):
|
||||
return os.path.isfile(os.path.join(QP_SRC, path_module,
|
||||
"NEEDED_CHILDREN_MODULES"))
|
||||
@ -290,4 +289,3 @@ if __name__ == '__main__':
|
||||
l_text = l_dir + l_file + l_symlink + l_exe
|
||||
l_text.sort()
|
||||
f.write("\n".join(l_text))
|
||||
|
||||
|
196
scripts/module/qp_update_readme.py
Executable file
196
scripts/module/qp_update_readme.py
Executable file
@ -0,0 +1,196 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Updates the README.rst of a module
|
||||
Usage:
|
||||
qp_update_readme.py [<module_path>...] [--root_module=<module_path>]
|
||||
|
||||
Options:
|
||||
path_readme: All the absolute path you want to update.
|
||||
By default is the cwd
|
||||
--root_module: Is the path of the root module who containt the tags file.
|
||||
By default is the cwd
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
from docopt import docopt
|
||||
except:
|
||||
print "Please check if you have sourced the .quantum_package.rc"
|
||||
print "(`source .quantum_package.rc`)"
|
||||
print sys.exit(1)
|
||||
|
||||
import os
|
||||
from collections import namedtuple
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
def header_format(str_):
|
||||
return "{0}\n{1}\n".format(str_, "=" * len(str_))
|
||||
|
||||
|
||||
D_KEY = {"needed_module": header_format("Needed Modules"),
|
||||
"documentation": header_format("Documentation")}
|
||||
|
||||
|
||||
URL = "http://github.com/LCPQ/quantum_package/tree/master/src"
|
||||
|
||||
HEADER = "\n".join([".. Do not edit this section It was auto-generated",
|
||||
".. by the `update_README.py` script."])
|
||||
|
||||
# d[Path] ={humain, needed_module, documentation}
|
||||
d_readme = defaultdict(dict)
|
||||
|
||||
|
||||
def fetch_splitted_data(l_module_readme):
|
||||
"""Read the README.rst file and split it in strings:
|
||||
* The documentation
|
||||
* The needed modules
|
||||
The result is given as a list of strings
|
||||
"""
|
||||
|
||||
sentinel = "@@$%&@@"
|
||||
|
||||
for path_readme in l_module_readme:
|
||||
with open(os.path.join(path_readme, "README.rst"), 'r') as f:
|
||||
data = f.read()
|
||||
|
||||
# Place sentinels
|
||||
|
||||
for v in D_KEY.values():
|
||||
data = data.replace(v, sentinel + v)
|
||||
|
||||
# Now Split data using the sentinels
|
||||
d_readme[path_readme] = {"human": data.split(sentinel)[0]}
|
||||
|
||||
|
||||
def update_needed(d_readme):
|
||||
"""Read the NEEDED_CHILDREN_MODULES file, and replace the data with it.
|
||||
Create the links to the GitHub pages."""
|
||||
|
||||
header_image = ".. image:: tree_dependency.png"
|
||||
|
||||
for path in d_readme:
|
||||
|
||||
with open(os.path.join(path, 'NEEDED_CHILDREN_MODULES'), 'r') as f:
|
||||
modules = f.read()
|
||||
|
||||
if modules.strip():
|
||||
l_module = ['* `{0} <{1}>`_'.format(name, os.path.join(URL, name))
|
||||
for name in modules.split()]
|
||||
|
||||
l_module_section = [D_KEY["needed_module"],
|
||||
HEADER, '',
|
||||
header_image, '',
|
||||
'\n'.join(l_module), '', '']
|
||||
else:
|
||||
l_module_section = ""
|
||||
|
||||
d_readme[path]["needed_module"] = "\n".join(l_module_section)
|
||||
|
||||
|
||||
def extract_doc(item):
|
||||
"""Extracts the documentation contained in IRPF90_man file"""
|
||||
|
||||
path = os.path.join(ROOT_module, "IRPF90_man/%s.l" % (item))
|
||||
with open(path, 'r') as f:
|
||||
l_line = f.readlines()
|
||||
|
||||
result = []
|
||||
inside = False
|
||||
for line in l_line:
|
||||
if not inside:
|
||||
inside = line.startswith(".SH Description")
|
||||
else:
|
||||
if line.startswith(".SH"):
|
||||
break
|
||||
result.append(" {0}".format(line.strip()))
|
||||
|
||||
if not result:
|
||||
result = [" Undocumented"]
|
||||
|
||||
return "\n".join(result) + "\n"
|
||||
|
||||
|
||||
def update_documentation(ROOT_module, d_readme):
|
||||
"""Reads the BEGIN_DOC ... END_DOC blocks and builds the documentation"""
|
||||
|
||||
IRP_info = namedtuple('IRP_info', ["module", "file", "provider", "line"])
|
||||
|
||||
# If the file does not exist, don't do anything
|
||||
path = os.path.join(ROOT_module, "tags")
|
||||
|
||||
with open(path, 'r') as f:
|
||||
dump = f.readlines()
|
||||
|
||||
d_info = defaultdict(list)
|
||||
|
||||
for i in dump:
|
||||
# i =
|
||||
# output_cpu_time_0 Ezfio_files/output.irp.f 2
|
||||
provider, irp_file_raw, ligne = i.split()
|
||||
|
||||
for path in d_readme:
|
||||
|
||||
if ROOT_module == path and "/" not in irp_file_raw:
|
||||
d_info[path].append(IRP_info(os.path.basename(path),
|
||||
irp_file_raw,
|
||||
provider,
|
||||
ligne))
|
||||
|
||||
elif "/" in irp_file_raw and os.path.dirname(irp_file_raw) in path:
|
||||
|
||||
module, irp_file = os.path.split(irp_file_raw)
|
||||
d_info[path].append(IRP_info(module, irp_file, provider, ligne))
|
||||
|
||||
for path in d_readme:
|
||||
|
||||
l_doc = []
|
||||
|
||||
for irp in d_info[path]:
|
||||
url = os.path.join(URL, os.path.basename(path), irp.file)
|
||||
doc = extract_doc(irp.provider)
|
||||
|
||||
l_doc += ["`{0} <{1}#L{2}>`_".format(irp.provider, url, irp.line),
|
||||
doc,
|
||||
""]
|
||||
|
||||
l_doc_section = [D_KEY["documentation"],
|
||||
HEADER, '',
|
||||
"\n".join(l_doc)]
|
||||
|
||||
d_readme[path]["documentation"] = "\n".join(l_doc_section)
|
||||
|
||||
if __name__ == '__main__':
|
||||
arguments = docopt(__doc__)
|
||||
|
||||
if arguments["--root_module"]:
|
||||
ROOT_module = os.path.realpath(arguments["--root_module"])
|
||||
else:
|
||||
ROOT_module = os.getcwd()
|
||||
|
||||
if not arguments["<module_path>"]:
|
||||
l_module_readme = [os.path.join(os.getcwd())]
|
||||
else:
|
||||
l_module_readme = arguments["<module_path>"]
|
||||
|
||||
try:
|
||||
fetch_splitted_data(l_module_readme)
|
||||
except IOError:
|
||||
print l_module_readme, "is not a module and/or",
|
||||
print "have not a `README.rst` file inside"
|
||||
print "Abort..."
|
||||
sys.exit(1)
|
||||
|
||||
update_needed(d_readme)
|
||||
update_documentation(ROOT_module, d_readme)
|
||||
|
||||
for path, d in d_readme.iteritems():
|
||||
|
||||
with open(os.path.join(path, "README.rst"), 'w') as f:
|
||||
for k in ["human",
|
||||
"needed_module",
|
||||
"documentation"]:
|
||||
|
||||
f.write(d[k])
|
@ -1,188 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""Updates the README.rst file as the include directive is disabled on GitHub."""
|
||||
__date__ = "Thu Apr 3 23:06:18 CEST 2014"
|
||||
__author__ = "Anthony Scemama<scemama@irsamc.ups-tlse.fr> & TApplencourt "
|
||||
|
||||
README = "README.rst"
|
||||
Assum_key = "Assumptions\n===========\n"
|
||||
Needed_key = "Needed Modules\n==============\n"
|
||||
Doc_key = "Documentation\n=============\n"
|
||||
Sentinel = "@@$%&@@"
|
||||
URL = "http://github.com/LCPQ/quantum_package/tree/master/src/"
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from collections import namedtuple
|
||||
import sys
|
||||
|
||||
"""
|
||||
NEED to call in a module
|
||||
First arg can be the root parent
|
||||
"""
|
||||
try:
|
||||
ROOT_module = os.path.realpath(sys.argv[1])
|
||||
except:
|
||||
ROOT_module = os.getcwd()
|
||||
|
||||
if ROOT_module != os.getcwd():
|
||||
change = True
|
||||
else:
|
||||
change = False
|
||||
|
||||
MODULE_NAME = os.path.basename(os.getcwd())
|
||||
|
||||
|
||||
header = """
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def fetch_splitted_data():
|
||||
"""Read the README.rst file and split it in strings:
|
||||
* The documentation
|
||||
* The needed modules
|
||||
The result is given as a list of strings
|
||||
"""
|
||||
|
||||
with open(README, 'r') as f:
|
||||
data = f.read()
|
||||
|
||||
# Place sentinels
|
||||
data = data.replace(Doc_key, Sentinel + Doc_key)
|
||||
data = data.replace(Needed_key, Sentinel + Needed_key)
|
||||
|
||||
# Now Split data using the sentinels
|
||||
result = data.split(Sentinel)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def update_needed(data):
|
||||
"""Read the NEEDED_CHILDREN_MODULES file, and replace the data with it.
|
||||
Create the links to the GitHub pages."""
|
||||
|
||||
with open('NEEDED_CHILDREN_MODULES', 'r') as f:
|
||||
modules = f.read()
|
||||
|
||||
header_image = ".. image:: tree_dependency.png\n\n"
|
||||
|
||||
if modules.strip():
|
||||
modules = ['* `{0} <{1}>`_'.format(name, os.path.join(URL, name))
|
||||
for name in modules.split()]
|
||||
modules = "\n".join(modules)
|
||||
modules = Needed_key + header + header_image + modules + '\n\n'
|
||||
|
||||
has_modules = False
|
||||
for i in range(len(data)):
|
||||
if data[i].startswith(Needed_key):
|
||||
has_modules = True
|
||||
data[i] = modules
|
||||
|
||||
if not has_modules:
|
||||
data.append(modules)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
def extract_doc(item):
|
||||
"""Extracts the documentation contained in IRPF90_man file"""
|
||||
|
||||
path = os.path.join(ROOT_module, "IRPF90_man/%s.l" % (item))
|
||||
with open(path, 'r') as f:
|
||||
l_line = f.readlines()
|
||||
|
||||
result = []
|
||||
inside = False
|
||||
for line in l_line:
|
||||
if not inside:
|
||||
inside = line.startswith(".SH Description")
|
||||
else:
|
||||
if line.startswith(".SH"):
|
||||
break
|
||||
result.append(" {0}".format(line.strip()))
|
||||
|
||||
if not result:
|
||||
result = [" Undocumented"]
|
||||
|
||||
return "\n".join(result) + '\n'
|
||||
|
||||
|
||||
def update_documentation(data):
|
||||
"""Reads the BEGIN_DOC ... END_DOC blocks and builds the documentation"""
|
||||
|
||||
IRP_info = namedtuple('IRP_info', ["name", "file", "line"])
|
||||
|
||||
# If the file does not exist, don't do anything
|
||||
|
||||
path = os.path.join(ROOT_module, "tags")
|
||||
|
||||
with open(path, 'r') as f:
|
||||
dump = f.readlines()
|
||||
|
||||
l_info = []
|
||||
for i in dump:
|
||||
name, f, ligne = i.split()
|
||||
|
||||
if not change and "/" not in i:
|
||||
l_info.append(IRP_info(name, f, ligne))
|
||||
elif change and MODULE_NAME in i:
|
||||
l_info.append(IRP_info(name, f.split("/")[-1], ligne))
|
||||
|
||||
l_line = []
|
||||
|
||||
for irp in l_info:
|
||||
url = os.path.join(URL, MODULE_NAME, irp.file)
|
||||
doc = extract_doc(irp.name)
|
||||
|
||||
l_line += ["`{0} <{1}#L{2}>`_".format(irp.name, url, irp.line), doc,
|
||||
""]
|
||||
|
||||
documentation = Doc_key + header + "\n".join(l_line)
|
||||
|
||||
has_doc = False
|
||||
for i in range(len(data)):
|
||||
if data[i].startswith(Doc_key):
|
||||
has_doc = True
|
||||
data[i] = documentation
|
||||
|
||||
if not has_doc:
|
||||
data.append(documentation)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
def git_add():
|
||||
"""Executes:
|
||||
git add README.rst
|
||||
throw an error if git is not precent"""
|
||||
|
||||
try:
|
||||
# pipe output to /dev/null for silence
|
||||
null = open("/dev/null", "w")
|
||||
subprocess.Popen("git add README.rst", stdout=null, stderr=null)
|
||||
null.close()
|
||||
|
||||
except OSError:
|
||||
raise
|
||||
|
||||
|
||||
def main():
|
||||
data = fetch_splitted_data()
|
||||
|
||||
data = update_documentation(data)
|
||||
data = update_needed(data)
|
||||
output = ''.join(data)
|
||||
|
||||
with open(README, 'w') as f:
|
||||
f.write(output)
|
||||
|
||||
try:
|
||||
git_add()
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -33,7 +33,7 @@ Assumptions
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -43,7 +43,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`ao_coef <http://github.com/LCPQ/quantum_package/tree/master/src/AO_Basis/ezfio_interface.irp.f#L24>`_
|
||||
|
@ -37,7 +37,7 @@ Assumptions
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -47,7 +47,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`bitstring_to_hexa <http://github.com/LCPQ/quantum_package/tree/master/src/Bitmask/bitmasks_routines.irp.f#L98>`_
|
||||
|
@ -29,7 +29,7 @@ Assumptions
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -40,7 +40,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`a_operator <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L962>`_
|
||||
|
@ -21,7 +21,7 @@ Assumptions
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -31,7 +31,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`elec_alpha_num <http://github.com/LCPQ/quantum_package/tree/master/src/Electrons/ezfio_interface.irp.f#L28>`_
|
||||
|
@ -13,7 +13,7 @@ MO integral, use ``get_mo_bielec_integral(i,j,k,l,mo_integrals_map)`` or
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -24,7 +24,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`add_integrals_to_map <http://github.com/LCPQ/quantum_package/tree/master/src/Integrals_Bielec/mo_bi_integrals.irp.f#L42>`_
|
||||
|
@ -1,7 +1,7 @@
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -12,7 +12,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`ao_deriv2_x <http://github.com/LCPQ/quantum_package/tree/master/src/Integrals_Monoelec/kin_ao_ints.irp.f#L1>`_
|
||||
|
@ -5,7 +5,7 @@ MOGuess Module
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -15,7 +15,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`ao_ortho_lowdin_coef <http://github.com/LCPQ/quantum_package/tree/master/src/MOGuess/mo_ortho_lowdin.irp.f#L2>`_
|
||||
|
@ -33,7 +33,7 @@ ASSUMPTONS
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -44,7 +44,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`ao_to_mo <http://github.com/LCPQ/quantum_package/tree/master/src/MO_Basis/mos.irp.f#L136>`_
|
||||
|
@ -9,7 +9,7 @@ The coordinates are expressed in atomic units.
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -20,7 +20,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`element_name <http://github.com/LCPQ/quantum_package/tree/master/src/Nuclei/nuclei.irp.f#L172>`_
|
||||
|
@ -5,7 +5,7 @@ Pseudo Module
|
||||
Needed Modules
|
||||
==============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
.. image:: tree_dependency.png
|
||||
@ -15,7 +15,7 @@ Needed Modules
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`do_pseudo <http://github.com/LCPQ/quantum_package/tree/master/src/Pseudo/ezfio_interface.irp.f#L248>`_
|
||||
|
@ -7,7 +7,7 @@ Contains general purpose utilities.
|
||||
Documentation
|
||||
=============
|
||||
|
||||
.. Do not edit this section. It was auto-generated from the
|
||||
.. Do not edit this section It was auto-generated
|
||||
.. by the `update_README.py` script.
|
||||
|
||||
`a_coef <http://github.com/LCPQ/quantum_package/tree/master/src/Utils/need.irp.f#L252>`_
|
||||
@ -634,4 +634,3 @@ Documentation
|
||||
`write_git_log <http://github.com/LCPQ/quantum_package/tree/master/src/Utils/util.irp.f#L243>`_
|
||||
Write the last git commit in file iunit.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user