From 7553b0877c41a0bb71b6b338183dbdabc30663e5 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Thu, 2 Jul 2015 09:40:21 +0200 Subject: [PATCH] Remove the raise, for only show the 'source message' / cleaning configure --- configure | 43 +++++++++++++++++------------ scripts/module/qp_install_module.py | 6 ++-- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/configure b/configure index 6e73d312..58367ac5 100755 --- a/configure +++ b/configure @@ -45,7 +45,7 @@ QP_ROOT = os.getcwd() QP_ROOT_BIN = join(QP_ROOT, "bin") QP_ROOT_INSTALL = join(QP_ROOT, "install") -os.environ["PATH"] = os.environ["PATH"] + ":"+QP_ROOT_BIN +os.environ["PATH"] = os.environ["PATH"] + ":" + QP_ROOT_BIN d_dependency = { "ocaml": ["m4", "curl", "zlib", "patch", "gcc"], @@ -72,7 +72,8 @@ path_github = {"head": "http://github.com/", "tail": "archive/master.tar.gz"} ocaml = Info( url='http://raw.github.com/ocaml/opam/master/shell/opam_installer.sh', - description=' Ocaml, Opam and the Core library (it will take some time roughly 20min)', + description= + ' Ocaml, Opam and the Core library (it will take some time roughly 20min)', default_path=join(QP_ROOT_BIN, "opam")) m4 = Info( @@ -128,12 +129,12 @@ ezfio = Info( d_info = dict() -for m in ["ocaml", "m4", "curl", "zlib", "path", "irpf90", "docopt", +for m in ["ocaml", "m4", "curl", "zlib", "path", "irpf90", "docopt", "resultsFile", "ninja", "emsl", "ezfio"]: exec ("d_info['{0}']={0}".format(m)) -def find_path(bin_, l_installed): +def find_path(bin_, l_installed, var_for_qp_root=False): """Use the global variable * l_installed * d_info @@ -143,6 +144,10 @@ def find_path(bin_, l_installed): locate = l_installed[bin_] except KeyError: locate = d_info[bin_].default_path + + if var_for_qp_root: + locate = locate.replace(QP_ROOT, "${QP_ROOT}") + return locate @@ -158,7 +163,8 @@ def check_output(*popenargs, **kwargs): >>> check_output(['/usr/bin/python', '--version']) Python 2.6.2 """ - process = subprocess.Popen(stdout=subprocess.PIPE,stderr=subprocess.PIPE, *popenargs, **kwargs) + process = subprocess.Popen(stdout=subprocess.PIPE, + stderr=subprocess.PIPE, *popenargs, **kwargs) output, unused_err = process.communicate() retcode = process.poll() if retcode: @@ -277,7 +283,8 @@ def installation(l_install_descendant): def create_rule_ninja(): l_rules = [ - "rule download", " command = wget --no-check-certificate ${url} -O ${out} -o /dev/null", + "rule download", + " command = wget --no-check-certificate ${url} -O ${out} -o /dev/null", " description = Downloading ${descr}", "" ] @@ -429,12 +436,15 @@ def create_ninja_and_rc(l_installed): if os.path.isdir(path): l_python.append(path) - l_rc = [ 'export QP_ROOT={0}'.format(QP_ROOT) ] + \ - [ i.replace(QP_ROOT,"${QP_ROOT}") for i in - [ - 'export QP_EZFIO={0}'.format(find_path('ezfio', l_installed)), - 'export IRPF90={0}'.format(find_path("irpf90", l_installed)), - 'export NINJA={0}'.format(find_path("ninja", l_installed)), + path_ezfio = find_path('ezfio', l_installed, var_for_qp_root=True) + path_irpf90 = find_path("irpf90", l_installed, var_for_qp_root=True) + path_ninja = find_path("ninja", l_installed, var_for_qp_root=True) + + l_rc = [ + 'export QP_ROOT={0}'.format(QP_ROOT), + 'export QP_EZFIO={0}'.format(path_ezfio), + 'export IRPF90={0}'.format(path_irpf90), + 'export NINJA={0}'.format(path_ninja), 'export QP_PYTHON={0}'.format(":".join(l_python)), "", 'export PYTHONPATH="${QP_PYTHON}":"${PYTHONPATH}"', 'export PATH="${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml:"${PATH}"', @@ -443,7 +453,7 @@ def create_ninja_and_rc(l_installed): 'source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh', "", 'source ${HOME}/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true', "" - ] ] + ] path = join(QP_ROOT, "quantum_package.rc") with open(path, "w+") as f: @@ -451,16 +461,14 @@ def create_ninja_and_rc(l_installed): print "[ OK ] ({0})".format(path) - print str_info("build"), - command = ['bash', '-c', 'source {0} && env'.format(path)] - proc = subprocess.Popen(command, stdout=subprocess.PIPE) - for line in proc.stdout: (key, _, value) = line.partition("=") os.environ[key] = value.strip() + print str_info("build"), + qp_create_ninja = os.path.join(QP_ROOT, "scripts", "compilation", "qp_create_ninja.py") @@ -474,7 +482,6 @@ def create_ninja_and_rc(l_installed): def recommendation(): - print "Last Step:" path = join(QP_ROOT, "quantum_package.rc") print "Now :" print " source {0}".format(path) diff --git a/scripts/module/qp_install_module.py b/scripts/module/qp_install_module.py index 8aad1ae1..60f7446a 100755 --- a/scripts/module/qp_install_module.py +++ b/scripts/module/qp_install_module.py @@ -23,10 +23,10 @@ try: from module_handler import get_l_module_descendant from update_README import Doc_key, Needed_key from qp_path import QP_SRC, QP_PLUGINS - except ImportError: - print "source .quantum_package.rc" - raise + print "Please check if you have source the .quantum_package.rc" + print "(`source .quantum_package.rc`)" + print sys.exit(1) def save_new_module(path, l_child):