10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-03 20:54:00 +01:00

Remove check_dependencies.sh, is no handle by module_handler.py

This commit is contained in:
Thomas Applencourt 2015-05-04 15:36:58 +02:00
parent fdc415b4a2
commit df086e5edd
7 changed files with 26 additions and 80 deletions

1
scripts/.gitignore vendored
View File

@ -1,2 +1,3 @@
*.pyc *.pyc
*.pyo *.pyo
docopt.py

View File

@ -1,64 +0,0 @@
#!/bin/bash
#
# usage:
# check_dependencies.sh MOs AOs Electrons
#
# Checks that the list of dependencies given in
# argument is consistent. If the dependencies
# are OK the exit code is 0, otherwise it is 1.
# If no argument is given, the dependencies are
# read in the Makefile.
# Thu Apr 3 01:44:23 CEST 2014
if [[ -z ${QPACKAGE_ROOT} ]]
then
print "The QPACKAGE_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file."
exit -1
fi
source ${QPACKAGE_ROOT}/scripts/qp_include.sh
if [[ -z $1 ]]
then
exit 0
fi
if [[ $1 == "-" ]]
then
COMMAND_LINE=$(module_handler.py print_genealogy NEEDED_MODULES)
else
COMMAND_LINE=$(unique_list $@)
fi
for d in $COMMAND_LINE
do
if [[ ! -d ${QPACKAGE_ROOT}/src/$d ]]
then
echo Error: Directory $d does not exist
exit 2
fi
done
DEPS_LONG=""
for i in $COMMAND_LINE
do
DEPS_LONG+=" $i "
DEPS_LONG+=$(module_handler.py print_genealogy "${QPACKAGE_ROOT}/src/${i}/NEEDED_MODULES")
done
DEPS=$(unique_list $DEPS_LONG)
if [[ ! "$COMMAND_LINE" == "$DEPS" ]]
then
DEPS=$(${QPACKAGE_ROOT}/scripts/check_dependencies.sh ${DEPS})
fi
echo "$DEPS"
if [[ "$COMMAND_LINE" == "$DEPS" ]]
then
exit 0
else
exit 1
fi

View File

@ -14,7 +14,5 @@ source ${QPACKAGE_ROOT}/scripts/qp_include.sh
check_current_dir_is_module check_current_dir_is_module
OUTPUT=$(${QPACKAGE_ROOT}/scripts/check_dependencies.sh $@) OUTPUT=$(module_handler.py check_dependencies $@)
echo ${OUTPUT} > NEEDED_MODULES echo $@ > NEEDED_CHILDREN_MODULES

View File

@ -126,7 +126,7 @@ debug "Makefile created"
# Create the NEEDED_MODULES file # Create the NEEDED_MODULES file
"${QPACKAGE_ROOT}/scripts/create/create_Needed_modules.sh" ${NEEDED_MODULES} || fail "Unable to create the NEEDED_MODULES file" "${QPACKAGE_ROOT}/scripts/create/create_Needed_modules.sh" ${NEEDED_MODULES} || fail "Unable to create the NEEDED_MODULES file"
if [[ ! -f NEEDED_MODULES ]] if [[ ! -f NEEDED_CHILDREN_MODULES ]]
then then
fail "NEEDED_MODULES was not created" fail "NEEDED_MODULES was not created"
fi fi

View File

@ -7,14 +7,16 @@ Create the NEEDED_MODULE
of a NEEDED_CHILDREN_MODULES file of a NEEDED_CHILDREN_MODULES file
Usage: Usage:
module_handler.py print_genealogy [<NEEDED_CHILDREN_MODULES>] module_handler.py print_genealogy [<NEEDED_CHILDREN_MODULES>]
module_handler.py create_png [<NEEDED_CHILDREN_MODULES>] module_handler.py check_dependencies [<module_name>...]
module_handler.py create_png [<NEEDED_CHILDREN_MODULES>]
Options: Options:
print_genealogy Print the genealogy of the NEEDED_CHILDREN_MODULES print_genealogy Print the genealogy of the NEEDED_CHILDREN_MODULES
aka (children, subchildren, etc) aka (children, subchildren, etc)
if NEEDED_CHILDREN_MODULES create_png Create a png of the file
try to open it in the current path NEEDED_CHILDREN_MODULES The path of NEEDED_CHILDREN_MODULES
by default try to open the file in the current path
""" """
from docopt import docopt from docopt import docopt
@ -73,8 +75,9 @@ def module_genealogy(path):
try: try:
with open(path, "r") as f: with open(path, "r") as f:
l_children = f.read().split() l_children = f.read().split()
except IOError: except IOError as e:
return [] print >> sys.stderr, e
sys.exit(1)
else: else:
needed_module = get_it_and_children(l_children) needed_module = get_it_and_children(l_children)
@ -169,6 +172,7 @@ def create_png(l_module):
# Save # Save
path = '{0}.png'.format("_".join(l_module)) path = '{0}.png'.format("_".join(l_module))
print "png saved in {0}".format(path)
graph.write_png(path) graph.write_png(path)
if __name__ == '__main__': if __name__ == '__main__':
@ -187,5 +191,12 @@ if __name__ == '__main__':
l_all_needed_molule = module_genealogy(path) l_all_needed_molule = module_genealogy(path)
print " ".join(sorted(l_all_needed_molule)) print " ".join(sorted(l_all_needed_molule))
if arguments["create_png"]: elif arguments["check_dependencies"]:
l_module = arguments['<module_name>']
if l_module:
l_all_needed_molule = get_it_and_children(l_module)
else:
l_all_needed_molule = module_genealogy(path)
elif arguments["create_png"]:
create_png_from_path(path) create_png_from_path(path)

View File

@ -14,7 +14,7 @@ check_current_dir_is_module
# Check if the NEEDED_MODULES file is consistent # Check if the NEEDED_MODULES file is consistent
INCLUDE_DIRS="${NEEDED_MODULES} include" INCLUDE_DIRS="${NEEDED_MODULES} include"
NEEDED_MODULES_OK=$( ${QPACKAGE_ROOT}/scripts/check_dependencies.sh ${NEEDED_MODULES} ) NEEDED_MODULES_OK=$(module_handler.py check_dependencies ${NEEDED_MODULES} )
if [[ $? -ne 0 ]] if [[ $? -ne 0 ]]
then then
error " error "

View File

@ -1 +1 @@
AOs Bielec_integrals Bitmask CID CID_SC2_selected CID_selected CIS CISD CISD_selected CISD_SC2_selected Determinants Electrons Ezfio_files Full_CI Generators_full Hartree_Fock MOGuess MonoInts MOs MP2 Nuclei Output Selectors_full Utils Molden FCIdump Generators_CAS CAS_SD DDCI_selected MRCC Pseudo_integrals AOs Bielec_integrals Bitmask CAS_SD CID CID_SC2_selected CID_selected CIS CISD CISD_SC2_selected CISD_selected DDCI_selected Determinants Electrons Ezfio_files FCIdump Full_CI Generators_CAS Generators_full Hartree_Fock MOGuess MOs MP2 MRCC Molden MonoInts Nuclei Output Perturbation Properties Pseudo_integrals Selectors_full SingleRefMethod Utils Toto