mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-25 05:51:46 +02:00
Auto-update README.rst
This commit is contained in:
parent
c7768ba335
commit
166df2ba8d
2
scripts/.gitignore
vendored
Normal file
2
scripts/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.pyc
|
||||||
|
*.pyo
|
@ -43,19 +43,6 @@ $UNDERLINE
|
|||||||
$MODULE Module
|
$MODULE Module
|
||||||
$UNDERLINE
|
$UNDERLINE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Assumptions
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. include:: ./ASSUMPTIONS.rst
|
|
||||||
|
|
||||||
|
|
||||||
Needed Modules
|
|
||||||
--------------
|
|
||||||
|
|
||||||
.. include:: ./NEEDED_MODULES
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
124
scripts/update_README.py
Executable file
124
scripts/update_README.py
Executable file
@ -0,0 +1,124 @@
|
|||||||
|
#!/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>"
|
||||||
|
|
||||||
|
|
||||||
|
README="README.rst"
|
||||||
|
Assum_key="Assumptions\n===========\n"
|
||||||
|
Needed_key="Needed Modules\n==============\n"
|
||||||
|
Sentinel="@@$%&@@"
|
||||||
|
|
||||||
|
|
||||||
|
def fetch_splitted_data():
|
||||||
|
"""Read the README.rst file and split it in 3 strings:
|
||||||
|
* The description
|
||||||
|
* The assumptions
|
||||||
|
* The needed modules
|
||||||
|
The result is given as a list of strings
|
||||||
|
"""
|
||||||
|
|
||||||
|
file = open(README,'r')
|
||||||
|
data = file.read()
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
# Place sentinels
|
||||||
|
data = data.replace(Assum_key,Sentinel+Assum_key)
|
||||||
|
data = data.replace(Needed_key,Sentinel+Needed_key)
|
||||||
|
|
||||||
|
# Now Split data using the sentinels
|
||||||
|
result = data.split(Sentinel)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def update_assumptions(data):
|
||||||
|
"""Read the ASSUMPTIONS.rst file, and replace the data with it."""
|
||||||
|
|
||||||
|
try:
|
||||||
|
file = open('ASSUMPTIONS.rst','r')
|
||||||
|
except IOError:
|
||||||
|
file = open('ASSUMPTIONS.rst','w')
|
||||||
|
assumptions = ""
|
||||||
|
else:
|
||||||
|
assumptions = file.read()
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
header = """
|
||||||
|
.. Do not edit this section. It was auto-generated from the
|
||||||
|
.. ASSUMPTIONS.rst file.
|
||||||
|
|
||||||
|
"""
|
||||||
|
if assumptions.strip() != "":
|
||||||
|
assumptions = Assum_key + header + assumptions + '\n\n'
|
||||||
|
|
||||||
|
has_assumptions = False
|
||||||
|
for i in range(len(data)):
|
||||||
|
if data[i].startswith(Assum_key):
|
||||||
|
has_assumptions = True
|
||||||
|
data[i] = assumptions
|
||||||
|
|
||||||
|
if not has_assumptions:
|
||||||
|
data.insert(1,assumptions)
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def update_needed(data):
|
||||||
|
"""Read the NEEDED_MODULES file, and replace the data with it."""
|
||||||
|
|
||||||
|
file = open('NEEDED_MODULES','r')
|
||||||
|
modules = file.read()
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
header = """
|
||||||
|
.. Do not edit this section. It was auto-generated from the
|
||||||
|
.. NEEDED_MODULES file.
|
||||||
|
|
||||||
|
"""
|
||||||
|
if modules.strip() != "":
|
||||||
|
modules = "\n".join(map(lambda x: '* %s'%(x), modules.split()))
|
||||||
|
modules = Needed_key + header + 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
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
def git_add():
|
||||||
|
"""Executes:
|
||||||
|
git add README.rst
|
||||||
|
if git is present on the machine."""
|
||||||
|
command = "git add "+README
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess.call(command.split())
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
data = fetch_splitted_data()
|
||||||
|
data = update_assumptions(data)
|
||||||
|
data = update_needed(data)
|
||||||
|
output = ''.join(data)
|
||||||
|
|
||||||
|
file = open(README,'w')
|
||||||
|
file.write(output)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
git_add()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
@ -9,11 +9,13 @@ then
|
|||||||
make irpf90
|
make irpf90
|
||||||
IRPF90=${QPACKAGE_ROOT}/irpf90/bin/irpf90
|
IRPF90=${QPACKAGE_ROOT}/irpf90/bin/irpf90
|
||||||
fi
|
fi
|
||||||
make EZFIO
|
|
||||||
|
|
||||||
cat << EOF > quantum_package.rc
|
cat << EOF > quantum_package.rc
|
||||||
export IRPF90=${IRPF90}
|
export IRPF90=${IRPF90}
|
||||||
export QPACKAGE_ROOT=${QPACKAGE_ROOT}
|
export QPACKAGE_ROOT=${QPACKAGE_ROOT}
|
||||||
export PATH+=:${QPACKAGE_ROOT}/scripts
|
export PATH+=:\${QPACKAGE_ROOT}/scripts
|
||||||
export PATH+=:${QPACKAGE_ROOT}/bin
|
export PATH+=:\${QPACKAGE_ROOT}/bin
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
source quantum_package.rc
|
||||||
|
make EZFIO
|
||||||
|
@ -2,16 +2,13 @@
|
|||||||
AOs Module
|
AOs Module
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Assumptions
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. include:: ./ASSUMPTIONS.rst
|
|
||||||
|
|
||||||
|
|
||||||
Needed Modules
|
Needed Modules
|
||||||
--------------
|
==============
|
||||||
|
|
||||||
.. include:: ./NEEDED_MODULES
|
.. Do not edit this section. It was auto-generated from the
|
||||||
|
.. NEEDED_MODULES file.
|
||||||
|
|
||||||
|
* Ezfio_files
|
||||||
|
* Nuclei
|
||||||
|
* Utils
|
||||||
|
|
||||||
|
0
src/ASSUMPTIONS.rst
Normal file
0
src/ASSUMPTIONS.rst
Normal file
@ -3,15 +3,16 @@ Bitmask Module
|
|||||||
==============
|
==============
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Assumptions
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. include:: ./ASSUMPTIONS.rst
|
|
||||||
|
|
||||||
|
|
||||||
Needed Modules
|
Needed Modules
|
||||||
--------------
|
==============
|
||||||
|
|
||||||
.. include:: ./NEEDED_MODULES
|
.. Do not edit this section. It was auto-generated from the
|
||||||
|
.. NEEDED_MODULES file.
|
||||||
|
|
||||||
|
* AOs
|
||||||
|
* Electrons
|
||||||
|
* Ezfio_files
|
||||||
|
* MOs
|
||||||
|
* Nuclei
|
||||||
|
* Utils
|
||||||
|
|
||||||
|
@ -7,13 +7,22 @@ are provided by this module.
|
|||||||
|
|
||||||
|
|
||||||
Assumptions
|
Assumptions
|
||||||
-----------
|
===========
|
||||||
|
|
||||||
.. include:: ./ASSUMPTIONS.rst
|
.. Do not edit this section. It was auto-generated from the
|
||||||
|
.. ASSUMPTIONS.rst file.
|
||||||
|
|
||||||
|
* ``elec_num`` >= 0
|
||||||
|
* ``elec_alpha_num`` >= 0
|
||||||
|
* ``elec_beta_num`` >= 0
|
||||||
|
* ``elec_alpha_num`` >= ``elec_beta_num``
|
||||||
|
|
||||||
|
|
||||||
Needed Modules
|
Needed Modules
|
||||||
--------------
|
==============
|
||||||
|
|
||||||
.. include:: ./NEEDED_MODULES
|
.. Do not edit this section. It was auto-generated from the
|
||||||
|
.. NEEDED_MODULES file.
|
||||||
|
|
||||||
|
* Ezfio_files
|
||||||
|
|
||||||
|
@ -2,16 +2,3 @@
|
|||||||
Ezfio_files Module
|
Ezfio_files Module
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Assumptions
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. include:: ./ASSUMPTIONS.rst
|
|
||||||
|
|
||||||
|
|
||||||
Needed Modules
|
|
||||||
--------------
|
|
||||||
|
|
||||||
.. include:: ./NEEDED_MODULES
|
|
||||||
|
|
||||||
|
@ -2,16 +2,14 @@
|
|||||||
MOs Module
|
MOs Module
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Assumptions
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. include:: ./ASSUMPTIONS.rst
|
|
||||||
|
|
||||||
|
|
||||||
Needed Modules
|
Needed Modules
|
||||||
--------------
|
==============
|
||||||
|
|
||||||
.. include:: ./NEEDED_MODULES
|
.. Do not edit this section. It was auto-generated from the
|
||||||
|
.. NEEDED_MODULES file.
|
||||||
|
|
||||||
|
* AOs
|
||||||
|
* Ezfio_files
|
||||||
|
* Nuclei
|
||||||
|
* Utils
|
||||||
|
|
||||||
|
@ -1,45 +1,108 @@
|
|||||||
include $(QPACKAGE_ROOT)/src/Makefile.config
|
# Check if QPACKAGE_ROOT is defined
|
||||||
|
|
||||||
ifndef QPACKAGE_ROOT
|
ifndef QPACKAGE_ROOT
|
||||||
$(error QPACKAGE_ROOT undefined. Run the setup_environment.sh script)
|
$(info -------------------- Error --------------------)
|
||||||
|
$(info QPACKAGE_ROOT undefined. Run the setup_environment.sh script)
|
||||||
|
$(info -----------------------------------------------)
|
||||||
|
$(error )
|
||||||
endif
|
endif
|
||||||
|
|
||||||
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
|
||||||
|
|
||||||
include Makefile.depend
|
# Check if the user's config exists
|
||||||
|
|
||||||
NEEDED_MODULES_OK=$(shell X=`$(QPACKAGE_ROOT)/scripts/check_dependencies.sh $(NEEDED_MODULES)` && echo OK || echo $$X)
|
|
||||||
ifneq ($(NEEDED_MODULES_OK),OK)
|
|
||||||
$(info ---------------------)
|
|
||||||
$(info Your NEEDED_MODULES file is inconsistent. It should be:)
|
|
||||||
$(info $(NEEDED_MODULES_OK))
|
|
||||||
$(info ---------------------)
|
|
||||||
$(error )
|
|
||||||
endif
|
|
||||||
|
|
||||||
IRP_VERSION_OK=$(shell $(IRPF90) -v | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= 1.3")
|
|
||||||
ifeq ($(IRP_VERSION_OK),False)
|
|
||||||
$(error 'IRPF90 version >= 1.3 is required')
|
|
||||||
endif
|
|
||||||
|
|
||||||
README_RST_OK=$(shell ls README.rst || echo Failed)
|
|
||||||
ASSUMPTIONS_RST_OK=$(shell ls ASSUMPTIONS.rst || echo Failed)
|
|
||||||
|
|
||||||
MAKEFILE_OK=$(shell ls $(QPACKAGE_ROOT)/src/Makefile.config 2> /dev/null && echo True || echo False)
|
MAKEFILE_OK=$(shell ls $(QPACKAGE_ROOT)/src/Makefile.config 2> /dev/null && echo True || echo False)
|
||||||
ifeq ($(MAKEFILE_OK),False)
|
ifeq ($(MAKEFILE_OK),False)
|
||||||
$(error 'Makefile.config is not present. Please modify Makefile.config.example to create Makefile.config')
|
$(info -------------------- Error --------------------)
|
||||||
|
$(info Makefile.config is not present.)
|
||||||
|
$(info You can create Makefile.config)
|
||||||
|
$(info by modifying Makefile.config.example)
|
||||||
|
$(info -----------------------------------------------)
|
||||||
|
$(error )
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# Include the user's config
|
||||||
|
|
||||||
|
include $(QPACKAGE_ROOT)/src/Makefile.config
|
||||||
|
|
||||||
|
|
||||||
|
# Check the version of IRPF90
|
||||||
|
|
||||||
|
IRP_VERSION_OK=$(shell $(IRPF90) -v | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= 1.3")
|
||||||
|
ifeq ($(IRP_VERSION_OK),False)
|
||||||
|
$(info -------------------- Error --------------------)
|
||||||
|
$(info IRPF90 version >= 1.3 is required)
|
||||||
|
$(info -----------------------------------------------)
|
||||||
|
$(error )
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# Check if the NEEDED_MODULES file is consistent
|
||||||
|
|
||||||
|
NEEDED_MODULES_OK=$(shell X=`$(QPACKAGE_ROOT)/scripts/check_dependencies.sh $(NEEDED_MODULES)` && echo OK || echo $$X)
|
||||||
|
ifneq ($(NEEDED_MODULES_OK),OK)
|
||||||
|
$(info -------------------- Error --------------------)
|
||||||
|
$(info Your NEEDED_MODULES file is inconsistent. It should be)
|
||||||
|
$(info $(NEEDED_MODULES_OK))
|
||||||
|
$(info -----------------------------------------------)
|
||||||
|
$(error )
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# Create the NEEDED_MODULES variable, needed for IRPF90
|
||||||
|
|
||||||
|
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
||||||
|
|
||||||
|
|
||||||
|
# Check and update dependencies
|
||||||
|
|
||||||
|
include Makefile.depend
|
||||||
|
|
||||||
|
|
||||||
|
# Check if README.rst exists
|
||||||
|
|
||||||
|
README_RST_OK=$(shell ls README.rst 2>/dev/null || echo False)
|
||||||
|
ifeq ($(README_RST_OK), False)
|
||||||
|
$(shell $(QPACKAGE_ROOT)/scripts/create_rst_templates.sh)
|
||||||
|
$(info -------------------- Error --------------------)
|
||||||
|
$(info README.rst was not present, so I created a)
|
||||||
|
$(info default one for you.)
|
||||||
|
$(info You should document it before you compile, as)
|
||||||
|
$(info well as the ASSUMPTIONS.rst file.)
|
||||||
|
$(info -----------------------------------------------)
|
||||||
|
$(error )
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# Check if ASSUMPTIONS.rst exists
|
||||||
|
|
||||||
|
ASSUMPTIONS_RST_OK=$(shell ls ASSUMPTIONS.rst || echo False)
|
||||||
|
ifeq ($(ASSUMPTIONS_RST_OK), False)
|
||||||
|
$(info -------------------- Error --------------------)
|
||||||
|
$(info This is a Bug. At that point, the ASSUMPTIONS.rst)
|
||||||
|
$(info file should exist.)
|
||||||
|
$(info -----------------------------------------------)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# Update the README.rst file for GitHub, and git add it
|
||||||
|
|
||||||
|
$(shell update_README.py)
|
||||||
|
|
||||||
|
|
||||||
|
# Define the Makefile common variables and rules
|
||||||
|
|
||||||
EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO
|
EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO
|
||||||
EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a
|
EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a
|
||||||
|
INCLUDE_DIRS=$(NEEDED_MODULES) include
|
||||||
|
|
||||||
$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config)
|
$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config)
|
||||||
@echo Building EZFIO library
|
@echo Building EZFIO library
|
||||||
@cp $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(EZFIO_DIR)/config
|
@cp $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(EZFIO_DIR)/config
|
||||||
@cd $(EZFIO_DIR) ; export FC="$(FC)" ; export FCFLAGS="$(FCFLAGS)" ; export IRPF90="$(IRPF90)" ; $(MAKE) ; $(MAKE) Python
|
@cd $(EZFIO_DIR) ; export FC="$(FC)" ; export FCFLAGS="$(FCFLAGS)" ; export IRPF90="$(IRPF90)" ; $(MAKE) ; $(MAKE) Python
|
||||||
|
|
||||||
INCLUDE_DIRS=$(NEEDED_MODULES) include
|
|
||||||
|
|
||||||
|
# Create symbolic links of other modules
|
||||||
|
|
||||||
ifneq ($(PWD),$(QPACKAGE_ROOT)/src)
|
ifneq ($(PWD),$(QPACKAGE_ROOT)/src)
|
||||||
$(shell $(QPACKAGE_ROOT)/scripts/prepare_module.sh $(INCLUDE_DIRS))
|
$(shell $(QPACKAGE_ROOT)/scripts/prepare_module.sh $(INCLUDE_DIRS))
|
||||||
@ -60,5 +123,7 @@ Makefile.depend: Makefile
|
|||||||
|
|
||||||
include irpf90.make
|
include irpf90.make
|
||||||
|
|
||||||
|
# Dummy rule to enable to force recompilation
|
||||||
|
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
|
@ -2,16 +2,12 @@
|
|||||||
Nuclei Module
|
Nuclei Module
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Assumptions
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. include:: ./ASSUMPTIONS.rst
|
|
||||||
|
|
||||||
|
|
||||||
Needed Modules
|
Needed Modules
|
||||||
--------------
|
==============
|
||||||
|
|
||||||
.. include:: ./NEEDED_MODULES
|
.. Do not edit this section. It was auto-generated from the
|
||||||
|
.. NEEDED_MODULES file.
|
||||||
|
|
||||||
|
* Ezfio_files
|
||||||
|
* Utils
|
||||||
|
|
||||||
|
@ -2,16 +2,7 @@
|
|||||||
Output Module
|
Output Module
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Assumptions
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. include:: ./ASSUMPTIONS.rst
|
|
||||||
|
|
||||||
|
|
||||||
Needed Modules
|
|
||||||
--------------
|
|
||||||
|
|
||||||
.. include:: ./NEEDED_MODULES
|
|
||||||
|
|
||||||
|
@ -103,3 +103,18 @@ should be always checked. For example, when creating a directory the existence
|
|||||||
of the directory has to be checked.
|
of the directory has to be checked.
|
||||||
|
|
||||||
|
|
||||||
|
Needed Modules
|
||||||
|
==============
|
||||||
|
|
||||||
|
.. Do not edit this section. It was auto-generated from the
|
||||||
|
.. NEEDED_MODULES file.
|
||||||
|
|
||||||
|
* AOs
|
||||||
|
* Bitmask
|
||||||
|
* Electrons
|
||||||
|
* Ezfio_files
|
||||||
|
* MOs
|
||||||
|
* Nuclei
|
||||||
|
* Output
|
||||||
|
* Utils
|
||||||
|
|
||||||
|
@ -15,3 +15,8 @@ Needed Modules
|
|||||||
|
|
||||||
.. include:: ./NEEDED_MODULES
|
.. include:: ./NEEDED_MODULES
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user