From 0cfef83090b9071bbb6ad6fb2cf039ec6cff5e52 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Sun, 9 Dec 2018 10:49:26 -0600 Subject: [PATCH] Fix a few things (#76) * Check if EZFIO is installed when sourcing qp.rc. Maybe need to be done elsewhere * Better message for f77zmq * Add better error message for Opam (tell people to install ocaml) * Better message for Opam location * Ezfio.sh is not an executable * Fix qp_modul install with the new pluging hierachy * Port back the LIB fixe * Add bats install script for test (How travis was working?) * Update travis * Fix important output problem * Update configure * Update quantum_package.rc.default --- .travis.yml | 1 + configure | 30 ++++++++++++++++++------ quantum_package.rc.default | 6 ++++- scripts/compilation/qp_create_ninja | 4 +++- scripts/module/qp_module | 36 +++++++++++++---------------- 5 files changed, 48 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index f53cb459..3cbcb769 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,5 +35,6 @@ python: script: - ./configure --install all --config ./config/travis.cfg + - ./configure --install bats - source ./quantum_package.rc ; ninja -j 1 -v - source ./quantum_package.rc ; cd tests ; ./run_tests.sh -v diff --git a/configure b/configure index e4c16af1..aaff9765 100755 --- a/configure +++ b/configure @@ -131,7 +131,7 @@ if [[ "${PACKAGES}.x" != ".x" ]] ; then fi if [[ ${PACKAGES} = all ]] ; then - PACKAGES="ninja irpf90 zeromq f77zmq ocaml ezfio emsl docopt resultsFile" + PACKAGES="ninja irpf90 zeromq f77zmq ocaml ezfio emsl docopt resultsFile bats" fi @@ -220,7 +220,7 @@ EOF else # Conventional commands export OPAMROOT=${OPAMROOT:-${QP_ROOT}/external/opam} - echo ${QP_ROOT}/bin + echo "QP>> Please install it here: " ${QP_ROOT}/bin ${QP_ROOT}/external/opam_installer.sh fi rm ${QP_ROOT}/external/opam_installer.sh @@ -276,7 +276,16 @@ EOF rm -rf resultsFile-master resultsFile.tar.gz cd "${QP_ROOT}" + elif [[ ${PACKAGE} = bats ]] ; then + cd "${QP_ROOT}"/external + git clone https://github.com/bats-core/bats-core.git + cd bats-core + ./install.sh . + ln -s ./bin/bats "${QP_ROOT}"/bin/bats + cd "${QP_ROOT}" fi + + done @@ -300,13 +309,13 @@ fi F77ZMQ=$(find_lib -lzmq -lf77zmq) if [[ ${F77ZMQ} = not_found ]] ; then - echo "Fortran binding of ZeroMQ is not installed." + echo "Fortran binding of ZeroMQ (f77zmq) is not installed." fail fi OPAM=$(find_exe opam) if [[ ${OPAM} = not_found ]] ; then - echo "OPAM package manager is not installed." + echo "OPAM (ocaml) package manager is not installed." fail fi @@ -340,9 +349,16 @@ if [[ ${RESULTSFILE} = not_found ]] ; then fail fi -echo "All dependencies installed." - - +echo " ___________________________ " +echo "< All dependencies installed. >" +echo " --------------------------- " +echo " \ ^__^ " +echo " \ (oo)\_______ " +echo " (__)\ )\/\. " +echo " ||----w | " +echo " || || " + + if [[ -n $CONFIG ]] ; then diff --git a/quantum_package.rc.default b/quantum_package.rc.default index a011c3b5..cdf260fa 100644 --- a/quantum_package.rc.default +++ b/quantum_package.rc.default @@ -26,7 +26,11 @@ export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_RO export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include) if [[ $SHELL == "/bin/bash" ]] ; then - source ${QP_EZFIO}/Bash/ezfio.sh + if [[ -f ${QP_EZFIO}/Bash/ezfio.sh ]]; then + source ${QP_EZFIO}/Bash/ezfio.sh + else + echo "EZFIO is not installed." + fi fi #### END Don't modify diff --git a/scripts/compilation/qp_create_ninja b/scripts/compilation/qp_create_ninja index a15c6c73..1d7462b8 100755 --- a/scripts/compilation/qp_create_ninja +++ b/scripts/compilation/qp_create_ninja @@ -97,7 +97,9 @@ def ninja_create_env_variable(pwd_config_file): l_string.append(str_) lib_lapack = get_compilation_option(pwd_config_file, "LAPACK_LIB") - str_lib = " ".join([LIB, lib_lapack, EZFIO_LIB, ZMQ_LIB]) + lib_usr = get_compilation_option(pwd_config_file, "LIB") + + str_lib = " ".join([LIB, lib_lapack, EZFIO_LIB, ZMQ_LIB, lib_usr]) l_string.append("LIB = {0} ".format(str_lib)) l_string.append("") diff --git a/scripts/module/qp_module b/scripts/module/qp_module index b0fe5794..1a6f32c8 100755 --- a/scripts/module/qp_module +++ b/scripts/module/qp_module @@ -7,6 +7,7 @@ Usage: qp_module install ... qp_module list (--installed | --available-local) qp_module uninstall + Options: list: List all the modules available create: Create a new module @@ -15,6 +16,9 @@ Options: import sys import os import subprocess +from os import listdir +from os.path import isdir, join + try: from docopt import docopt @@ -66,12 +70,11 @@ def save_new_module(path, l_child): """) def main(arguments): - - if arguments in ["list_installed", "list_plugins"]: - if arguments["list_installed"]: + if arguments["list"]: + if arguments["--installed"]: l_repository = [QP_SRC] - elif arguments["list_plugins"]: - l_repository = [QP_PLUGINS] + elif arguments["--available-local"]: + l_repository = [join(QP_PLUGINS, f) for f in listdir(QP_PLUGINS) if isdir(join(QP_PLUGINS, f))] m_instance = ModuleHandler(l_repository) @@ -112,7 +115,6 @@ def main(arguments): save_new_module(path, l_child_reduce) print " [ OK ]" -# print "` {0} install {1} `".format(os.path.basename(__file__), name) print "" arguments["create"]=False arguments["install"]=True @@ -121,23 +123,15 @@ def main(arguments): elif arguments["download"]: print "Not yet implemented" pass -# d_local = get_dict_child([QP_SRC]) -# d_remote = get_dict_child(arguments[""]) -# -# d_child = d_local.copy() -# d_child.update(d_remote) -# -# name = arguments[""] -# l_module_descendant = get_l_module_descendant(d_child, [name]) -# -# for module in l_module_descendant: -# if module not in d_local: -# print "you need to install", module elif arguments["install"]: + # Python 2.6 ... + d_module_location= dict() + d_local = get_dict_child([QP_SRC]) - d_plugin = get_dict_child([QP_PLUGINS]) + d_plugin = get_dict_child([join(QP_PLUGINS, f) for f in listdir(QP_PLUGINS) if isdir(join(QP_PLUGINS, f))]) + d_child = d_local.copy() d_child.update(d_plugin) @@ -164,7 +158,9 @@ def main(arguments): print "Installation...", for module_to_cp in l_module_to_cp: - src = os.path.join(QP_PLUGINS, module_to_cp) + + # Find the module. This is ugly. Quick fix, we should refactor + src = [ join(QP_PLUGINS, f, module_to_cp) for f in listdir(QP_PLUGINS) if isdir(join(QP_PLUGINS, f,module_to_cp) ) ][0] des = os.path.join(QP_SRC, module_to_cp) try: os.symlink(src, des)