diff --git a/scripts/.gitignore b/scripts/.gitignore index 52e4e611..e456a8d3 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,2 +1,3 @@ *.pyc *.pyo +docopt.py \ No newline at end of file diff --git a/scripts/check_dependencies.sh b/scripts/check_dependencies.sh deleted file mode 100755 index 37e9ba00..00000000 --- a/scripts/check_dependencies.sh +++ /dev/null @@ -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 diff --git a/scripts/create/create_Needed_modules.sh b/scripts/create/create_Needed_modules.sh index 026eadab..1158058c 100755 --- a/scripts/create/create_Needed_modules.sh +++ b/scripts/create/create_Needed_modules.sh @@ -14,7 +14,5 @@ source ${QPACKAGE_ROOT}/scripts/qp_include.sh check_current_dir_is_module -OUTPUT=$(${QPACKAGE_ROOT}/scripts/check_dependencies.sh $@) -echo ${OUTPUT} > NEEDED_MODULES - - +OUTPUT=$(module_handler.py check_dependencies $@) +echo $@ > NEEDED_CHILDREN_MODULES \ No newline at end of file diff --git a/scripts/create/create_module.sh b/scripts/create/create_module.sh index 90c6586b..a30c1484 100755 --- a/scripts/create/create_module.sh +++ b/scripts/create/create_module.sh @@ -126,7 +126,7 @@ debug "Makefile created" # 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 fail "NEEDED_MODULES was not created" fi diff --git a/scripts/module/module_handler.py b/scripts/module/module_handler.py index 1bb91253..3bc1d0e4 100755 --- a/scripts/module/module_handler.py +++ b/scripts/module/module_handler.py @@ -7,14 +7,16 @@ Create the NEEDED_MODULE of a NEEDED_CHILDREN_MODULES file Usage: - module_handler.py print_genealogy [] - module_handler.py create_png [] + module_handler.py print_genealogy [] + module_handler.py check_dependencies [...] + module_handler.py create_png [] Options: - print_genealogy Print the genealogy of the NEEDED_CHILDREN_MODULES - aka (children, subchildren, etc) - if NEEDED_CHILDREN_MODULES - try to open it in the current path + print_genealogy Print the genealogy of the NEEDED_CHILDREN_MODULES + aka (children, subchildren, etc) + create_png Create a png of the file + NEEDED_CHILDREN_MODULES The path of NEEDED_CHILDREN_MODULES + by default try to open the file in the current path """ from docopt import docopt @@ -73,8 +75,9 @@ def module_genealogy(path): try: with open(path, "r") as f: l_children = f.read().split() - except IOError: - return [] + except IOError as e: + print >> sys.stderr, e + sys.exit(1) else: needed_module = get_it_and_children(l_children) @@ -169,6 +172,7 @@ def create_png(l_module): # Save path = '{0}.png'.format("_".join(l_module)) + print "png saved in {0}".format(path) graph.write_png(path) if __name__ == '__main__': @@ -187,5 +191,12 @@ if __name__ == '__main__': l_all_needed_molule = module_genealogy(path) print " ".join(sorted(l_all_needed_molule)) - if arguments["create_png"]: + elif arguments["check_dependencies"]: + l_module = arguments[''] + 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) diff --git a/scripts/run_Makefile_common.sh b/scripts/run_Makefile_common.sh index c0e88a1e..a92507e2 100755 --- a/scripts/run_Makefile_common.sh +++ b/scripts/run_Makefile_common.sh @@ -14,7 +14,7 @@ check_current_dir_is_module # Check if the NEEDED_MODULES file is consistent 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 ]] then error " diff --git a/src/NEEDED_MODULES b/src/NEEDED_MODULES index 4533ccfe..b4c717a9 100644 --- a/src/NEEDED_MODULES +++ b/src/NEEDED_MODULES @@ -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