10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-23 12:56:14 +01:00

Merge pull request #69 from TApplencourt/master

Ninja build
This commit is contained in:
Anthony Scemama 2015-06-09 10:34:08 +02:00
commit 4dbb2a1a1a
61 changed files with 767 additions and 664 deletions

View File

@ -10,7 +10,7 @@ before_script:
- sudo apt-get install graphviz - sudo apt-get install graphviz
script: script:
- ./setup_environment.sh --robot - ./setup_environment.py
- source ./quantum_package.rc - source ./quantum_package.rc
- qp_create_ninja.py --production ./config/gfortran_example.cfg - qp_create_ninja.py --production ./config/gfortran_example.cfg
- ninja - ninja

View File

@ -12,11 +12,11 @@ The script to create the dependencies file (aka `build.ninja`) is `create_ninja_
## Compilation Flag ## Compilation Flag
You need to specify all the flag useful for the compilation: like the optimization one, the mkl one .``$QPACKAGE_ROOT/config`` contains ``ifort.cfg`` and ``gfortran.cfg`` files which have the compiler flags that will be used to compile the code. You can edit these files to modify the compiling option. Put the file path when calling `create_ninja_build.py` You need to specify all the flag useful for the compilation: like the optimization one, the mkl one .``$QP_ROOT/config`` contains ``ifort.cfg`` and ``gfortran.cfg`` files which have the compiler flags that will be used to compile the code. You can edit these files to modify the compiling option. Put the file path when calling `create_ninja_build.py`
## Example to create the Ninja file ## Example to create the Ninja file
`create_ninja_build.py --production $QPACKAGE_ROOT/config/ifort.cfg` `create_ninja_build.py --production $QP_ROOT/config/ifort.cfg`
# WARNING # WARNING
@ -24,8 +24,8 @@ For now reload this command if you add a `IRP.f90` or `EZFIO.cfg` file or modify
## Compile ## Compile
Just type `ninja` if you are in `$QPACKAGE_ROOT` (or `ninja -f $QPACKAGE_ROOT/build.ninja` elsewhere). The compilation will take approximately 3 min. Just type `ninja` if you are in `$QP_ROOT` (or `ninja -f $QP_ROOT/build.ninja` elsewhere). The compilation will take approximately 3 min.
If you have set the `--developement` flag in a specific module you can go in the corresponding IRPF90_temp and run `ninja` to only make the module and submodule binaries. (You can use the `-f` option too) If you have set the `--developement` flag in a specific module you can go in the corresponding IRPF90_temp and run `ninja` to only make the module and submodule binaries. (You can use the `-f` option too)
Now go in `$QPACKAGE_ROOT/ocaml` and type `make` Now go in `$QP_ROOT/ocaml` and type `make`

View File

@ -1,7 +0,0 @@
all: executables
.PHONY: executables
executables:
cd $(QPACKAGE_ROOT)/src ; $(MAKE) executables
mv $(QPACKAGE_ROOT)/src/executables .

View File

@ -1,17 +1,17 @@
# `ei_handler.py` # `ei_handler.py`
This script in located in `$QPACKAGE_ROOT/scripts/ezfio_interface/`. This script in located in `$QP_ROOT/scripts/ezfio_interface/`.
It provide all the resource need to deal with the `EZFIO.cfg` files : It provide all the resource need to deal with the `EZFIO.cfg` files :
- The creation of `$MODULE_LOWER_ezfio_config` in `$QPACKAGE_ROOT/ezfio/config` - The creation of `$MODULE_LOWER_ezfio_config` in `$QP_ROOT/ezfio/config`
- The `ezfio_interface.irp.f` who containt all the provider associate (in `$MODULE/`) - The `ezfio_interface.irp.f` who containt all the provider associate (in `$MODULE/`)
- The `$MODULE_LOWER_ezfio_defaults` in `$QPACKAGE_ROOT/data/` - The `$MODULE_LOWER_ezfio_defaults` in `$QP_ROOT/data/`
- The `Input_$MODULE_LOWER.ml` for the *qp_edit* - The `Input_$MODULE_LOWER.ml` for the *qp_edit*
For more information you can type `ei_handler.py -h` For more information you can type `ei_handler.py -h`
# `module_handler.py` # `module_handler.py`
This script in located in `$QPACKAGE_ROOT/scripts/module/`. This script in located in `$QP_ROOT/scripts/module/`.
It provide all the resource related to the tree dependancy of the modules. It provide all the resource related to the tree dependancy of the modules.
If more useful as a librairy than a cli. If more useful as a librairy than a cli.
@ -23,19 +23,21 @@ It have some usefull property:
- The dict of the root - The dict of the root
- The list reduced tree (For a list of module in input return only the root) - The list reduced tree (For a list of module in input return only the root)
For tree syntax you can check http://en.wikipedia.org/wiki/Tree_%28data_structure%29#Terminologies_used_in_Trees
In the cli mode: In the cli mode:
- From a `NEEDED_CHILDREN_MODULE` file you can have all the descendant, and a png - From a `NEEDED_CHILDREN_MODULE` file you can have all the descendant, and a png
representation who correspond. representation who correspond.
# `qp_install_module.py` # `qp_install_module.py`
This script is located in `$QPACKAGE_ROOT/scripts/module/`. This script is located in `$QP_ROOT/scripts/module/`.
It is usefull when you need to install a new module. (From the soon to come repo or from scratch). It is usefull when you need to install a new module. (From the soon to come repo or from scratch).
# `qp_create_ninja.py` # `qp_create_ninja.py`
This script is located in `$QPACKAGE_ROOT/scripts/compilation/`. This script is located in `$QP_ROOT/scripts/compilation/`.
It will create the `build.ninja` file. It will use intersifly the `module_handler.py` module. It will create the `build.ninja` file. It will use intersifly the `module_handler.py` module.
To read all the flag for the compilation the module `read_compilation_cfg.py` is used. To read all the flag for the compilation the module `read_compilation_cfg.py` is used.

0
install/Downloads/.gitignore vendored Normal file
View File

0
install/_build/.gitignore vendored Normal file
View File

10
install/scripts/build.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash -x
# This script should be included
BUILD=_build/${TARGET}
rm -rf -- ${BUILD}
mkdir ${BUILD} || exit 1
tar -zxf Downloads/${TARGET}.tar.gz --strip-components=1 --directory=${BUILD} || exit 1
_install || exit 1
rm -rf -- ${BUILD} _build/${TARGET}.log
exit 0

19
install/scripts/install_curl.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash -x
TARGET=curl
function _install()
{
cd ..
QP_ROOT=$PWD
cd -
cd ${BUILD} || return 1
mv curl.ermine ${QP_ROOT}/bin/curl || return 1
}
BUILD=_build/${TARGET}
rm -rf -- ${BUILD}
mkdir ${BUILD} || exit 1
tar -xvjf Downloads/${TARGET}.tar.bz2 --strip-components=1 --directory=${BUILD} || exit 1
_install || exit 1
rm -rf -- ${BUILD} _build/${TARGET}.log
exit 0

View File

@ -0,0 +1,10 @@
#!/bin/bash -x
TARGET=docopt
function _install()
{
cp -R ${BUILD} . || exit 1
}
source scripts/build.sh

10
install/scripts/install_emsl.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash -x
TARGET=emsl
function _install()
{
cp -R ${BUILD} . || exit 1
}
source scripts/build.sh

View File

@ -0,0 +1,16 @@
#!/bin/bash -x
TARGET=ezfio
function _install()
{
cd ..
QP_ROOT=$PWD
cd -
rm -rf ${QP_ROOT}/EZFIO
cd ${BUILD}/config || return 1
cd -
mv ${BUILD} ${QP_ROOT}/install/EZFIO || return 1
}
source scripts/build.sh

View File

@ -0,0 +1,24 @@
#!/bin/bash -x
TARGET=irpf90
function _install()
{
cd ..
QP_ROOT=$PWD
cd -
make -C ${BUILD} || return 1
rm -rf -- ./irpf90
mv ${BUILD} . || return 1
[[ -x ./irpf90/bin/irpf90 ]] || return 1
[[ -x ./irpf90/bin/irpman ]] || return 1
rm -rf -- ../bin/irpf90 ../bin/irpman
echo 'exec ${QP_ROOT}/install/irpf90/bin/irpf90 $@' > ../bin/irpf90 || return 1
echo 'exec ${QP_ROOT}/install/irpf90/bin/irpman $@' > ../bin/irpman || return 1
chmod +x ../bin/irpf90 ../bin/irpman || return 1
return 0
}
source scripts/build.sh

15
install/scripts/install_m4.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash -x
TARGET=m4
function _install()
{
cd ..
QP_ROOT=$PWD
cd -
cd ${BUILD}
./configure && make || exit 1
ln -sf ${PWD}/src/m4 ${QP_ROOT}/bin || exit 1
}
source scripts/build.sh

View File

@ -0,0 +1,14 @@
#!/bin/bash -x
TARGET=ninja
function _install()
{
cd ${BUILD} || return 1
./configure.py --bootstrap || return 1
cd -
mv ${BUILD}/ninja ../bin/ || return 1
return 0
}
source scripts/build.sh

View File

@ -0,0 +1,39 @@
#!/bin/bash
cd ..
QP_ROOT=$PWD
cd -
# Normal installation
PACKAGES="core cryptokit ocamlfind sexplib"
declare -i i
i=$(gcc -dumpversion | cut -d '.' -f 2)
if [[ i -lt 6 ]]
then
echo "GCC version $(gcc -dumpversion) too old. GCC >= 4.6 required."
exit 1
fi
if [[ -d ${HOME}/.opam ]]
then
source ${HOME}/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
fi
cd Downloads || exit 1
chmod +x ocaml.sh || exit 1
echo N | ./ocaml.sh ${QP_ROOT}/bin/ || exit 1
${QP_ROOT}/bin/opam config setup -a -q || exit 1
export LD_LIBRARY_PATH=${QP_ROOT}/lib:${LD_LIBRARY_PATH}
export LIBRARY_PATH=${QP_ROOT}/lib:${LIBRARY_PATH}
export C_INCLUDE_PATH=${QP_ROOT}/lib:${C_INCLUDE_PATH}
source ${HOME}/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
${QP_ROOT}/bin/opam install ${PACKAGES} -y -q || exit 1
rm -f ../_build/ocaml.log
exit 0

View File

@ -0,0 +1,19 @@
#!/bin/bash -x
TARGET=patch
function _install()
{
mkdir ${TARGET}
cd ..
QP_ROOT=$PWD
cd -
cd ${BUILD}
./configure --prefix=${QP_ROOT}/install/${TARGET} && make || exit 1
make install || exit 1
cd -
cp ${TARGET}/bin/${TARGET} ${QP_ROOT}/bin || exit 1
rm -R -- ${TARGET} || exit 1
}
source scripts/build.sh

View File

@ -0,0 +1,11 @@
#!/bin/bash -x
TARGET=resultsFile
function _install()
{
cp -R ${BUILD} . || exit 1
}
source scripts/build.sh

19
install/scripts/install_zlib.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash -x
TARGET=zlib
function _install()
{
rm -rf -- ${TARGET}
mkdir ${TARGET} || exit 1
cd ..
QP_ROOT=$PWD
cd -
cd ${BUILD}
./configure && make || exit 1
make install prefix=$QP_ROOT/install/${TARGET} || exit 1
ln -s -f $QP_ROOT/install/${TARGET}/lib/libz.so $QP_ROOT/lib || exit 1
ln -s -f $QP_ROOT/install/${TARGET}/lib/libz.a $QP_ROOT/lib || exit 1
}
source scripts/build.sh

0
lib/.gitignore vendored Normal file
View File

View File

@ -1,9 +1,9 @@
.NOPARALLEL: .NOPARALLEL:
# Check if QPACKAGE_ROOT is defined # Check if QP_ROOT is defined
ifndef QPACKAGE_ROOT ifndef QP_ROOT
$(info -------------------- Error --------------------) $(info -------------------- Error --------------------)
$(info QPACKAGE_ROOT undefined. Source the quantum_package.rc script) $(info QP_ROOT undefined. Source the quantum_package.rc script)
$(info -----------------------------------------------) $(info -----------------------------------------------)
$(error ) $(error )
endif endif
@ -32,10 +32,10 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore
echo $$i ; \ echo $$i ; \
done > .gitignore done > .gitignore
executables: $(QPACKAGE_ROOT)/data/executables executables: $(QP_ROOT)/data/executables
$(QPACKAGE_ROOT)/data/executables: $(QP_ROOT)/data/executables:
$(QPACKAGE_ROOT)/scripts/module/create_executables_list.sh $(QP_ROOT)/scripts/module/create_executables_list.sh
external_libs: external_libs:
opam install cryptokit core opam install cryptokit core
@ -62,8 +62,8 @@ qp_run.native: $(MLFILES) $(MLIFILES) executables
$(OCAMLBUILD) $*.native -use-ocamlfind $(PKGS) $(OCAMLBUILD) $*.native -use-ocamlfind $(PKGS)
ln -s $*.native $* ln -s $*.native $*
ezfio.ml: ${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml ezfio.ml: ${QP_ROOT}/install/EZFIO/Ocaml/ezfio.ml
cp ${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml . cp ${QP_ROOT}/install/EZFIO/Ocaml/ezfio.ml .
qptypes_generator.byte: qptypes_generator.ml qptypes_generator.byte: qptypes_generator.ml
$(OCAMLBUILD) qptypes_generator.byte -use-ocamlfind $(OCAMLBUILD) qptypes_generator.byte -use-ocamlfind
@ -71,8 +71,8 @@ qptypes_generator.byte: qptypes_generator.ml
Qptypes.ml: qptypes_generator.byte Qptypes.ml: qptypes_generator.byte
./qptypes_generator.byte > Qptypes.ml ./qptypes_generator.byte > Qptypes.ml
${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml: ${QP_ROOT}/install/EZFIO/Ocaml/ezfio.ml:
$(MAKE) -C ${QPACKAGE_ROOT}/src ezfio $(MAKE) -C ${QP_ROOT}/install/src ezfio
Input_auto_generated.ml qp_edit.ml: Input_auto_generated.ml qp_edit.ml:
ei_handler.py ocaml_global ei_handler.py ocaml_global

View File

@ -5,8 +5,8 @@ open Qputils;;
(** Variables related to the quantum package installation *) (** Variables related to the quantum package installation *)
let root = let root =
match (Sys.getenv "QPACKAGE_ROOT") with match (Sys.getenv "QP_ROOT") with
| None -> failwith "QPACKAGE_ROOT environment variable is not set. | None -> failwith "QP_ROOT environment variable is not set.
Please source the quantum_package.rc file." Please source the quantum_package.rc file."
| Some x -> x | Some x -> x
;; ;;
@ -59,7 +59,7 @@ let executables = lazy (
|> List.filter ~f:(fun x -> x <> "") |> List.filter ~f:(fun x -> x <> "")
in in
match e with match e with
| [a;b] -> (a,String.substr_replace_all ~pattern:"$QPACKAGE_ROOT" ~with_:root b) | [a;b] -> (a,String.substr_replace_all ~pattern:"$QP_ROOT" ~with_:root b)
| _ -> ("","") | _ -> ("","")
) )
in in

View File

@ -1,62 +0,0 @@
#!/usr/bin/env python
import os
import sys
import shelve
import hashlib
import re
r = re.compile(ur'-c\s+(\S+\.[fF]90)\s+-o\s+(\S+\.o)')
p = re.compile(ur'-I IRPF90_temp/\S*\s+')
mod = re.compile(ur'module\s+(?P<mod>\S+).+end\s?module\s+(?P=mod)?', re.MULTILINE | re.IGNORECASE)
TMPDIR="/tmp/qp_compiler/"
def main():
# Create temp directory
if "qp_compiler" not in os.listdir("/tmp"):
os.mkdir("/tmp/qp_compiler/")
line = sys.argv[1:]
command = " ".join(line)
command_clean = p.sub('',command)
try:
match = r.search(command_clean)
input = match.group(1)
output = match.group(2)
except:
os.system(command)
return
m = hashlib.md5()
# Fread : read input
with open(input,'r') as file:
fread = file.read()
m.update( " ".join( [ command, fread ] ))
# Md5 Key containing command + content of Fread
key = TMPDIR+m.hexdigest()
try:
# Try to return the content of the .o file
with open(key,'r') as file:
result = file.read()
except IOError:
# Compile the file -> .o
os.system(command)
# Read the .o
with open(output,'r') as file:
result = file.read()
# Copy the .o in database
if not mod.search(fread.replace('\n',' ')):
with open(key,'w') as file:
file.write(result)
else:
print input+' -> module'
else:
# Write the .o file
with open(output,'w') as file:
file.write(result)
if __name__ == '__main__':
main()

View File

@ -104,5 +104,5 @@ if __name__ == '__main__':
try: try:
cache_utility(command) cache_utility(command)
except: except OSError:
process = subprocess.Popen(command, shell=True) process = subprocess.Popen(command, shell=True)

View File

@ -24,11 +24,11 @@ except ImportError:
# \_| | (_) |_) (_| | \/ (_| | | (_| |_) | (/_ _> # \_| | (_) |_) (_| | \/ (_| | | (_| |_) | (/_ _>
# #
QPACKAGE_ROOT = os.environ['QPACKAGE_ROOT'] QP_ROOT = os.environ['QP_ROOT']
QPACKAGE_ROOT_SRC = join(QPACKAGE_ROOT, 'src') QP_ROOT_SRC = join(QP_ROOT, 'src')
QPACKAGE_ROOT_EZFIO = join(QPACKAGE_ROOT, 'EZFIO') QP_ROOT_EZFIO = join(QP_ROOT, 'install', 'EZFIO')
EZFIO_LIB = join(QPACKAGE_ROOT_EZFIO, "lib", "libezfio.a") EZFIO_LIB = join(QP_ROOT, "lib", "libezfio.a")
# #
# |\ | _. ._ _ _ _| _|_ ._ | _ # |\ | _. ._ _ _ _| _|_ ._ | _
@ -57,8 +57,7 @@ def ninja_create_env_variable(pwd_config_file):
l_string.append(str_) l_string.append(str_)
lib_lapack = get_compilation_option(pwd_config_file, "LAPACK_LIB") lib_lapack = get_compilation_option(pwd_config_file, "LAPACK_LIB")
lib_ezfio = join(QPACKAGE_ROOT_EZFIO, "lib", "libezfio_irp.a") l_string.append("{0} = {1} {2}".format("LIB", lib_lapack, EZFIO_LIB))
l_string.append("{0} = {1} {2}".format("LIB", lib_lapack, lib_ezfio))
l_string.append("") l_string.append("")
@ -76,14 +75,14 @@ def dict_module_genelogy_path(d_module_genelogy):
""" """
d = dict() d = dict()
for module_rel, l_children_rel in d_module_genelogy.iteritems(): for module_rel, l_children_rel in d_module_genelogy.iteritems():
module_abs = join(QPACKAGE_ROOT_SRC, module_rel) module_abs = join(QP_ROOT_SRC, module_rel)
p = Path(module_abs, module_rel) p = Path(module_abs, module_rel)
try: try:
d[p] = Path(join(QPACKAGE_ROOT_SRC, l_children_rel), d[p] = Path(join(QP_ROOT_SRC, l_children_rel),
l_children_rel) l_children_rel)
except: except:
d[p] = [Path(join(QPACKAGE_ROOT_SRC, children), children) d[p] = [Path(join(QP_ROOT_SRC, children), children)
for children in l_children_rel] for children in l_children_rel]
return d return d
@ -100,7 +99,7 @@ def get_l_module_with_ezfio_cfg():
""" """
from os import listdir from os import listdir
from os.path import isfile, join from os.path import isfile, join
qp_src = QPACKAGE_ROOT_SRC qp_src = QP_ROOT_SRC
return [join(qp_src, m) for m in listdir(qp_src) return [join(qp_src, m) for m in listdir(qp_src)
if isfile(join(qp_src, m, "EZFIO.cfg"))] if isfile(join(qp_src, m, "EZFIO.cfg"))]
@ -113,10 +112,10 @@ def get_l_ezfio_config():
l = [] l = []
cmd = "{0}/*/*.ezfio_config".format(QPACKAGE_ROOT_SRC) cmd = "{0}/*/*.ezfio_config".format(QP_ROOT_SRC)
for path_in_module in glob.glob(cmd): for path_in_module in glob.glob(cmd):
name_lower = os.path.split(path_in_module)[1].lower() name_lower = os.path.split(path_in_module)[1].lower()
path_in_ezfio = join(QPACKAGE_ROOT_EZFIO, "config", name_lower) path_in_ezfio = join(QP_ROOT_EZFIO, "config", name_lower)
l.append(EZ_config_path(path_in_module, path_in_ezfio)) l.append(EZ_config_path(path_in_module, path_in_ezfio))
return l return l
@ -147,7 +146,7 @@ def get_children_of_ezfio_cfg(l_module_with_ezfio_cfg):
""" """
From a module list of ezfio_cfg return all the stuff create by him From a module list of ezfio_cfg return all the stuff create by him
""" """
config_folder = join(QPACKAGE_ROOT_EZFIO, "config") config_folder = join(QP_ROOT_EZFIO, "config")
l_util = dict() l_util = dict()
@ -223,8 +222,9 @@ def ninja_ezfio_rule():
l_flag = ["export {0}='${0}'".format(flag) l_flag = ["export {0}='${0}'".format(flag)
for flag in ["FC", "FCFLAGS", "IRPF90"]] for flag in ["FC", "FCFLAGS", "IRPF90"]]
l_cmd = ["cd {0}".format(QPACKAGE_ROOT_EZFIO) l_cmd = ["cd {0}".format(QP_ROOT_EZFIO)
] + l_flag + ["ninja"] ] + l_flag + ["ninja && ln -f {0} {1}".format(join(QP_ROOT, 'install', 'EZFIO',"lib","libezfio.a"),
EZFIO_LIB)]
l_string = ["rule build_ezfio", l_string = ["rule build_ezfio",
" command = {0}".format(" ; ".join(l_cmd)), " command = {0}".format(" ; ".join(l_cmd)),
@ -245,7 +245,7 @@ def ninja_ezfio_build(l_ezfio_config, l_util):
str_ = " ".join(l_ezfio_config + l_ezfio_from_cfg) str_ = " ".join(l_ezfio_config + l_ezfio_from_cfg)
ezfio_make_config = join(QPACKAGE_ROOT_EZFIO,"make.config") ezfio_make_config = join(QP_ROOT_EZFIO, "make.config")
l_string = ["build {0} {1}: build_ezfio {2}".format(EZFIO_LIB, l_string = ["build {0} {1}: build_ezfio {2}".format(EZFIO_LIB,
ezfio_make_config, ezfio_make_config,
str_), ""] str_), ""]
@ -262,7 +262,7 @@ def get_source_destination(path_module, l_needed_molule):
Return a list of Sym_link = namedtuple('Sym_link', ['source', 'destination']) Return a list of Sym_link = namedtuple('Sym_link', ['source', 'destination'])
for a module for a module
""" """
return [Sym_link(m.abs, join(QPACKAGE_ROOT_SRC, path_module.rel, m.rel)) return [Sym_link(m.abs, join(QP_ROOT_SRC, path_module.rel, m.rel))
for m in l_needed_molule] for m in l_needed_molule]
@ -296,29 +296,30 @@ def ninja_symlink_build(path_module, l_symlink):
# o ._ ._ _|_ (_| / \ ._ _ _. | _ # o ._ ._ _|_ (_| / \ ._ _ _. | _
# | | |_) | | \_/ o | | | (_| |< (/_ # | | |_) | | \_/ o | | | (_| |< (/_
# | # |
def get_l_file_for_module(path_module_abs): def get_l_file_for_module(path_module):
''' '''
return the list of irp.f in a module return the list of irp.f in a module
''' '''
l_irp = [] l_depend = []
l_src = [] l_src = []
l_obj = [] l_obj = []
l_template = [] l_template = []
for f in os.listdir(path_module_abs): for f in os.listdir(path_module.abs):
if f.lower().endswith(tuple([".template.f", ".include.f"])): if f.lower().endswith(tuple([".template.f", ".include.f"])):
l_template.append(join(path_module_abs, f)) l_template.append(join(path_module.abs, f))
elif f.endswith(".irp.f"): elif f.endswith(".irp.f"):
l_irp.append(join(path_module_abs, f)) l_depend.append(join(path_module.abs, f))
elif f.lower().endswith(tuple([".f", ".f90", ".c", ".cpp", ".cxx"])): elif f.lower().endswith(tuple([".f", ".f90", ".c", ".cpp", ".cxx"])):
l_src.append(join(path_module_abs, f)) l_depend.append(join(path_module.abs,f))
l_src.append(f)
obj = '{0}.o'.format(os.path.splitext(f)[0]) obj = '{0}.o'.format(os.path.splitext(f)[0])
l_obj.append(join(path_module_abs, obj)) l_obj.append(obj)
elif f == "EZFIO.cfg": elif f == "EZFIO.cfg":
l_irp.append(join(path_module_abs, "ezfio_interface.irp.f")) l_depend.append(join(path_module.abs, "ezfio_interface.irp.f"))
d = {"l_irp": l_irp, d = {"l_depend": l_depend,
"l_src": l_src, "l_src": l_src,
"l_obj": l_obj, "l_obj": l_obj,
"l_template": l_template} "l_template": l_template}
@ -334,11 +335,21 @@ def get_file_dependency(d_info_module):
for module, l_children in d_info_module.iteritems(): for module, l_children in d_info_module.iteritems():
for key, values in get_l_file_for_module(module.abs).iteritems(): for key, values in get_l_file_for_module(module).iteritems():
if key in ["l_src"]:
values = [join(module.abs,o) for o in values]
if key in ["l_obj"]:
values = [join(module.abs,"IRPF90_temp",o) for o in values]
d_irp[module][key] = values d_irp[module][key] = values
for children in l_children: for children in l_children:
for key, values in get_l_file_for_module(children.abs).iteritems(): for key, values in get_l_file_for_module(children).iteritems():
if key in ["l_src"]:
values = [join(module.abs,children.rel,o) for o in values]
if key in ["l_obj"]:
values = [join(module.abs,"IRPF90_temp",children.rel,o) for o in values]
d_irp[module][key].extend(values) d_irp[module][key].extend(values)
return d_irp return d_irp
@ -388,24 +399,24 @@ def ninja_irpf90_make_build(path_module, l_needed_molule, d_irp):
l_creation = [join(path_module.abs, i) l_creation = [join(path_module.abs, i)
for i in ["irpf90.make", "irpf90_entities", "tags", for i in ["irpf90.make", "irpf90_entities", "tags",
"IRPF90_temp/build.ninja"]] "build.ninja"]]
str_creation = " ".join(l_creation) str_creation = " ".join(l_creation)
# ~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~ #
# D e p e n d a n c y # # D e p e n d a n c y #
# ~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~ #
l_irp_need = d_irp[path_module]["l_irp"] l_depend = d_irp[path_module]["l_depend"]
l_src = d_irp[path_module]["l_src"] l_src = d_irp[path_module]["l_src"]
l_obj = d_irp[path_module]["l_obj"] l_obj = d_irp[path_module]["l_obj"]
l_template = d_irp[path_module]["l_template"] l_template = d_irp[path_module]["l_template"]
if l_needed_molule: if l_needed_molule:
l_destination = ["l_symlink_{0}".format(path_module.rel)] l_symlink = ["l_symlink_{0}".format(path_module.rel)]
else: else:
l_destination = [] l_symlink = []
str_depend = " ".join(l_irp_need + l_destination + l_src + l_template) str_depend = " ".join(l_depend + l_symlink + l_template)
# ~#~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~#~ #
# N i n j a _ b u i l d # # N i n j a _ b u i l d #
@ -521,7 +532,7 @@ def ninja_binaries_rule():
# c m d # # c m d #
# ~#~#~ # # ~#~#~ #
l_cmd = ["cd $module/IRPF90_temp", "ninja"] l_cmd = ["cd $module", "ninja"]
# ~#~#~#~#~#~ # # ~#~#~#~#~#~ #
# s t r i n g # # s t r i n g #
@ -543,7 +554,7 @@ def ninja_binaries_build(path_module, l_children, d_binaries):
# c m d # # c m d #
# ~#~#~ # # ~#~#~ #
ninja_module_path = join(path_module.abs, "IRPF90_temp", "build.ninja") ninja_module_path = join(path_module.abs, "build.ninja")
l_abs_bin = [binary.abs for binary in d_binaries[path_module]] l_abs_bin = [binary.abs for binary in d_binaries[path_module]]
# ~#~#~#~#~#~ # # ~#~#~#~#~#~ #
@ -694,5 +705,5 @@ if __name__ == "__main__":
l_string += ninja_binaries_build(module_to_compile, l_children, l_string += ninja_binaries_build(module_to_compile, l_children,
d_binaries_production) d_binaries_production)
with open(join(QPACKAGE_ROOT, "build.ninja"), "w+") as f: with open(join(QP_ROOT, "build.ninja"), "w+") as f:
f.write("\n".join(l_string)) f.write("\n".join(l_string))

View File

@ -36,7 +36,7 @@ def get_compilation_option(pwd_cfg, flag_name):
if __name__ == '__main__': if __name__ == '__main__':
qpackage_root = os.environ['QPACKAGE_ROOT'] qpackage_root = os.environ['QP_ROOT']
pwd_cfg = os.path.join(qpackage_root, "config/gfortran_example.cfg") pwd_cfg = os.path.join(qpackage_root, "config/gfortran_example.cfg")
print get_compilation_option(pwd_cfg, "FC") print get_compilation_option(pwd_cfg, "FC")

View File

@ -21,11 +21,11 @@ Options:
(aka all with the `interface: input` parameter) (aka all with the `interface: input` parameter)
in `${pwd}` in `${pwd}`
--ezfio_config Create the `${module_lower}_ezfio_interface_config` in --ezfio_config Create the `${module_lower}_ezfio_interface_config` in
`${QPACKAGE_ROOT}/EZFIO/config/` `${QP_ROOT}/EZFIO/config/`
This file is needed by *EZFIO* to create the `libezfio.so` This file is needed by *EZFIO* to create the `libezfio.so`
--ocaml Create the `Input_module.lower.ml` for the *qp_edit* --ocaml Create the `Input_module.lower.ml` for the *qp_edit*
--ezfio_default Create the `${module_lower}_ezfio_interface_default` in --ezfio_default Create the `${module_lower}_ezfio_interface_default` in
`${QPACKAGE_ROOT}/data/ezfio_defaults` needed by `${QP_ROOT}/data/ezfio_defaults` needed by
the ocaml the ocaml
ocaml_global Create the qp_edit ocaml_global Create the qp_edit
@ -100,7 +100,7 @@ def get_type_dict():
# ~#~#~#~#~ # # ~#~#~#~#~ #
# P i c l e # # P i c l e #
# ~#~#~#~#~ # # ~#~#~#~#~ #
qpackage_root = os.environ['QPACKAGE_ROOT'] qpackage_root = os.environ['QP_ROOT']
# ~#~#~#~ # # ~#~#~#~ #
# I n i t # # I n i t #
@ -325,7 +325,7 @@ def save_ezfio_provider(path_head, dict_code_provider):
path = "{0}/ezfio_interface.irp.f".format(path_head) path = "{0}/ezfio_interface.irp.f".format(path_head)
l_output = ["! DO NOT MODIFY BY HAND", l_output = ["! DO NOT MODIFY BY HAND",
"! Created by $QPACKAGE_ROOT/scripts/ezfio_interface.py", "! Created by $QP_ROOT/scripts/ezfio_interface.py",
"! from file {0}/EZFIO.cfg".format(path_head), "! from file {0}/EZFIO.cfg".format(path_head),
"\n"] "\n"]
@ -368,7 +368,7 @@ def create_ezfio_stuff(dict_ezfio_cfg, config_or_default="config"):
if begin[0] == '-': if begin[0] == '-':
a_size_raw.append("{0}+{1}+1".format(end, begin[1:])) a_size_raw.append("{0}+{1}+1".format(end, begin[1:]))
else: else:
a_size_raw.append("{0}-{1}+1".format(end, begin)) a_size_raw.append("{0}-{1}+1".format(end, begin))
size_raw = ",".join(a_size_raw) size_raw = ",".join(a_size_raw)
@ -452,12 +452,10 @@ def create_ezfio_config(dict_ezfio_cfg):
def save_ezfio_config(module_lower, str_ezfio_config): def save_ezfio_config(module_lower, str_ezfio_config):
""" """
Write the str_ezfio_config in Write the str_ezfio_config in
"$QPACKAGE_ROOT/EZFIO/{0}.ezfio_interface_config".format(module_lower) "$QP_ROOT/EZFIO/{0}.ezfio_interface_config".format(module_lower)
""" """
name = "{0}.ezfio_interface_config".format(module_lower)
root_ezfio = "{0}/EZFIO".format(os.environ['QPACKAGE_ROOT']) path = os.path.join(os.environ['QP_EZFIO'], "config", name)
path = "{0}/config/{1}.ezfio_interface_config".format(root_ezfio,
module_lower)
with open(path, "w+") as f: with open(path, "w+") as f:
f.write(str_ezfio_config) f.write(str_ezfio_config)
@ -471,11 +469,11 @@ def create_ezfio_default(dict_ezfio_cfg):
def save_ezfio_default(module_lower, str_ezfio_default): def save_ezfio_default(module_lower, str_ezfio_default):
""" """
Write the str_ezfio_config in Write the str_ezfio_config in
"$QPACKAGE_ROOT/data/ezfio_defaults/{0}.ezfio_interface_default".format(module_lower) "$QP_ROOT/data/ezfio_defaults/{0}.ezfio_interface_default".format(module_lower)
""" """
root_ezfio_default = "{0}/data/ezfio_defaults/".format( root_ezfio_default = "{0}/data/ezfio_defaults/".format(
os.environ['QPACKAGE_ROOT']) os.environ['QP_ROOT'])
path = "{0}/{1}.ezfio_interface_default".format(root_ezfio_default, path = "{0}/{1}.ezfio_interface_default".format(root_ezfio_default,
module_lower) module_lower)
with open(path, "w+") as f: with open(path, "w+") as f:
@ -580,10 +578,10 @@ def create_ocaml_input(dict_ezfio_cfg, module_lower):
def save_ocaml_input(module_lower, str_ocaml_input): def save_ocaml_input(module_lower, str_ocaml_input):
""" """
Write the str_ocaml_input in Write the str_ocaml_input in
$QPACKAGE_ROOT/ocaml/Input_{0}.ml".format(module_lower) $QP_ROOT/ocaml/Input_{0}.ml".format(module_lower)
""" """
path = "{0}/ocaml/Input_{1}.ml".format(os.environ['QPACKAGE_ROOT'], path = "{0}/ocaml/Input_{1}.ml".format(os.environ['QP_ROOT'],
module_lower) module_lower)
with open(path, "w+") as f: with open(path, "w+") as f:
@ -600,7 +598,7 @@ def get_l_module_with_auto_generate_ocaml_lower():
# I n i t # # I n i t #
# ~#~#~#~ # # ~#~#~#~ #
mypath = "{0}/src".format(os.environ['QPACKAGE_ROOT']) mypath = "{0}/src".format(os.environ['QP_ROOT'])
# ~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~ #
# L _ f o l d e r # # L _ f o l d e r #
@ -641,7 +639,7 @@ def create_ocaml_input_global(l_module_with_auto_generate_ocaml_lower):
from ezfio_generate_ocaml import EZFIO_ocaml from ezfio_generate_ocaml import EZFIO_ocaml
qpackage_root = os.environ['QPACKAGE_ROOT'] qpackage_root = os.environ['QP_ROOT']
path = qpackage_root + "/scripts/ezfio_interface/qp_edit_template" path = qpackage_root + "/scripts/ezfio_interface/qp_edit_template"
with open(path, "r") as f: with open(path, "r") as f:
@ -663,10 +661,10 @@ def create_ocaml_input_global(l_module_with_auto_generate_ocaml_lower):
def save_ocaml_input_auto(str_ocaml_input_global): def save_ocaml_input_auto(str_ocaml_input_global):
""" """
Write the str_ocaml_input in Write the str_ocaml_input in
$QPACKAGE_ROOT/ocaml/Input_auto_generated.ml $QP_ROOT/ocaml/Input_auto_generated.ml
""" """
path = "{0}/ocaml/Input_auto_generated.ml".format(os.environ['QPACKAGE_ROOT']) path = "{0}/ocaml/Input_auto_generated.ml".format(os.environ['QP_ROOT'])
with open(path, "w+") as f: with open(path, "w+") as f:
f.write(str_ocaml_input_global) f.write(str_ocaml_input_global)
@ -675,10 +673,10 @@ def save_ocaml_input_auto(str_ocaml_input_global):
def save_ocaml_qp_edit(str_ocaml_qp_edit): def save_ocaml_qp_edit(str_ocaml_qp_edit):
""" """
Write the str_ocaml_qp_edit in Write the str_ocaml_qp_edit in
$QPACKAGE_ROOT/ocaml/qp_edit.ml $QP_ROOT/ocaml/qp_edit.ml
""" """
path = "{0}/ocaml/qp_edit.ml".format(os.environ['QPACKAGE_ROOT']) path = "{0}/ocaml/qp_edit.ml".format(os.environ['QP_ROOT'])
with open(path, "w+") as f: with open(path, "w+") as f:
f.write(str_ocaml_qp_edit) f.write(str_ocaml_qp_edit)
@ -773,7 +771,7 @@ if __name__ == "__main__":
# G e t _ l _ d i c t _ e z f i o _ c f g # # G e t _ l _ d i c t _ e z f i o _ c f g #
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~# # # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~# #
qpackage_root_src = join(os.environ['QPACKAGE_ROOT'], "src") qpackage_root_src = join(os.environ['QP_ROOT'], "src")
l_module_with_ezfio = [] l_module_with_ezfio = []

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
This function acceep convert output of gamess/GAU$$IAN to ezfio
Usage: Usage:
qp_convert_output_to_ezfio.py <file.out> [--ezfio=<folder.ezfio>] qp_convert_output_to_ezfio.py <file.out> [--ezfio=<folder.ezfio>]
@ -24,14 +24,14 @@ from functools import reduce
try: try:
QPACKAGE_ROOT = os.environ["QPACKAGE_ROOT"] QP_ROOT = os.environ["QP_ROOT"]
except: except:
print "Error: QPACKAGE_ROOT environment variable not found." print "Error: QP_ROOT environment variable not found."
sys.exit(1) sys.exit(1)
else: else:
sys.path = [QPACKAGE_ROOT + "/EZFIO/Python", sys.path = [QP_ROOT + "/install/EZFIO/Python",
QPACKAGE_ROOT + "/resultsFile", QP_ROOT + "/resultsFile",
QPACKAGE_ROOT + "/scripts"] + sys.path QP_ROOT + "/scripts"] + sys.path
# ~#~#~#~#~#~ # # ~#~#~#~#~#~ #
# I m p o r t # # I m p o r t #

View File

@ -260,7 +260,7 @@ Edit input data
| Assert_failure (file, line, ch) as e -> | Assert_failure (file, line, ch) as e ->
begin begin
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n"; Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
Printf.eprintf "Assert error in file $QPACKAGE_ROOT/ocaml/%s, line %d, character %d\n\n" file line ch; Printf.eprintf "Assert error in file $QP_ROOT/ocaml/%s, line %d, character %d\n\n" file line ch;
Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n"; Printf.eprintf "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
(* restore_backup ezfio_file; *) (* restore_backup ezfio_file; *)
raise e raise e

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
file = open(os.environ["QPACKAGE_ROOT"]+'/src/Determinants/H_apply.template.f','r') file = open(os.environ["QP_ROOT"]+'/src/Determinants/H_apply.template.f','r')
template = file.read() template = file.read()
file.close() file.close()

View File

@ -8,15 +8,14 @@
# Prints in stdout the name of a temporary file containing the basis set. # Prints in stdout the name of a temporary file containing the basis set.
# #
if [[ -z ${QPACKAGE_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
print "The QPACKAGE_ROOT environment variable is not set." print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file." print "Please reload the quantum_package.rc file."
exit -1 exit -1
fi fi
export EMSL_API_ROOT="${QPACKAGE_ROOT}"/EMSL_Basis/ export EMSL_API_ROOT="${QP_ROOT}"/install/emsl
export PYTHONPATH="${EMSL_API_ROOT}":${PYTHONPATH}
tmpfile="$1" tmpfile="$1"
shift shift

View File

@ -1,31 +0,0 @@
#!/bin/bash
#
# Installs curl for ocaml
# Mon Jan 12 18:52:48 CET 2015
CURL="curl-7.30.0.ermine"
CURL_URL="http://qmcchem.ups-tlse.fr/files/scemama/${CURL}.tar.bz2"
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit -1
fi
cd ${QPACKAGE_ROOT}
curl -kL "https://github.com/LCPQ/quantum_package" &> /dev/null
if [[ $? -eq 0 ]]
then
exit 0
fi
rm -f -- ${QPACKAGE_ROOT}/bin/curl
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py ${CURL_URL} CURL.tar.bz2
tar -jxf CURL.tar.bz2 && rm CURL.tar.bz2 ||exit 1
cd ${CURL} || exit 1
mv curl.ermine ${QPACKAGE_ROOT}/bin/curl
cd ${QPACKAGE_ROOT}
rm -rf -- ${CURL}

View File

@ -1,21 +0,0 @@
#!/bin/bash
#
# Installs docopt
# lundi 27 avril 2015, 16:51:34 (UTC+0200)
DOCOPT="docopt.py"
DOCOPT_URL="https://raw.githubusercontent.com/docopt/docopt/master/${DOCOPT}"
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit -1
fi
cd ${QPACKAGE_ROOT}
rm -f -- scripts/${DOCOPT}{,c}
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py ${DOCOPT_URL} ${DOCOPT}
mv ${DOCOPT} scripts/utility/${DOCOPT}

View File

@ -1,23 +0,0 @@
#!/bin/bash
#
# Installs EMSL_Basis_Set_Exchange_Local
# Mon Jan 12 12:57:19 CET 2015
BASE="EMSL_Basis_Set_Exchange_Local"
URL="https://github.com/LCPQ/${BASE}/archive/master.tar.gz"
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit -1
fi
cd ${QPACKAGE_ROOT}
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/${BASE}.tar.gz
tar -zxf ${BASE}.tar.gz && rm ${BASE}.tar.gz ||exit 1
rm -rf EMSL_Basis
mv ${BASE}-master EMSL_Basis

View File

@ -1,24 +0,0 @@
#!/bin/bash
#
# Installs EZFIO
# Mon Jan 12 16:06:44 CET 2015
BASE="ezfio"
URL="https://github.com/LCPQ/${BASE}/archive/master.tar.gz"
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit -1
fi
cd ${QPACKAGE_ROOT}
rm -rf -- EZFIO
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/${BASE}.tar.gz
tar -zxf ${BASE}.tar.gz && rm ${BASE}.tar.gz ||exit 1
mv EZFIO-master EZFIO

View File

@ -1,29 +0,0 @@
#!/bin/bash
#
# Installs irpf90
# Mon Jan 12 16:00:20 CET 2015
BASE="irpf90"
URL="https://github.com/LCPQ/${BASE}/archive/master.tar.gz"
# Check the QPACKAGE_ROOT directory
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit 1
fi
cd ${QPACKAGE_ROOT}
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/${BASE}.tar.gz
tar -zxf ${BASE}.tar.gz && rm ${BASE}.tar.gz ||exit 1
mv ${BASE}-master irpf90
make -C irpf90
rm -rf -- bin/irpf90 bin/irpman
echo '${QPACKAGE_ROOT}/irpf90/bin/irpf90 $@' > bin/irpf90
echo '${QPACKAGE_ROOT}/irpf90/bin/irpman $@' > bin/irpman
chmod +x bin/irpf90 bin/irpman

View File

@ -1,31 +0,0 @@
#!/bin/bash
#
# Installs m4 for ocaml
# Thu Oct 23 22:02:08 CEST 2014
M4_URL="http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz"
M4=$(which m4)
# Check the QPACKAGE_ROOT directory
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit 1
fi
cd ${QPACKAGE_ROOT}
rm -f l${QPACKAGE_ROOT}/bin/m4
if [[ -z ${M4} ]]
then
rm -f -- bin/m4
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py ${M4_URL} M4.tar.gz
tar -zxf M4.tar.gz && rm M4.tar.gz ||exit 1
cd m4* || exit 1
./configure && make || exit 1
ln -s ${PWD}/src/m4 ${QPACKAGE_ROOT}/bin
else
ln -s ${M4} ${QPACKAGE_ROOT}/bin/m4
fi

View File

@ -1,23 +0,0 @@
#!/bin/bash
#
# Installs the ninja build system
# Thu May 28 13:21:16 CEST 2015
BASE="ninja"
URL="https://github.com/martine/ninja/archive/master.tar.gz"
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit -1
fi
cd ${QPACKAGE_ROOT}
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/${BASE}.tar.gz
tar -zxf ${BASE}.tar.gz && rm ${BASE}.tar.gz ||exit 1
rm -rf ${BASE}
mv ${BASE}-master ${BASE}
cd ${BASE}
./configure.py --bootstrap

View File

@ -1,67 +0,0 @@
#!/bin/bash
#
# Downloads and installs ocaml, opam and core library
# Thu Oct 23 21:58:40 CEST 2014
PACKAGES="core cryptokit"
OPAM_BASE=$HOME/.opam
# Check the QPACKAGE_ROOT directory
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit 1
fi
cd ${QPACKAGE_ROOT}
if [[ -f quantum_package.rc ]]
then
source quantum_package.rc
fi
make -C ocaml Qptypes.ml &> /dev/null
if [[ $? -ne 0 ]]
then
if [[ -d ${OPAM_BASE} ]]
then
echo "${OPAM_BASE} exists."
echo "Re-install ? [y/N]"
while read -r -n 1 -s answer; do
if [[ $answer = [YyNn] ]]; then
if [[ $answer = [Yy] ]] ; then
echo " - Remove your directory ${OPAM_BASE}"
echo " - Restart setup"
exit 1
fi
if [[ $answer = [Nn] ]] ; then
make -C ocaml Qptypes.ml
exit 0
fi
fi
done
fi
fi
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py \
"https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh" opam_installer.sh
chmod +x opam_installer.sh
echo N | ./opam_installer.sh ${QPACKAGE_ROOT}/bin
if [[ ! -f ${QPACKAGE_ROOT}/bin/opam ]]
then
echo "Installation of OPAM failed"
exit 2
fi
rm -f opam_installer.sh
${QPACKAGE_ROOT}/bin/opam config setup -a --dot-profile ${QPACKAGE_ROOT}/quantum_package.rc
source ${QPACKAGE_ROOT}/quantum_package.rc
echo Y | opam install ${PACKAGES}
make -C ocaml Qptypes.ml
exit 0

View File

@ -1,24 +0,0 @@
#!/bin/bash
#
# Installs the resultsFile Python library
# Mon Jan 19 15:08:18 CET 2015
URL="https://github.com/LCPQ/resultsFile/archive/master.tar.gz"
# Check the QPACKAGE_ROOT directory
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit 1
fi
cd ${QPACKAGE_ROOT}
rm -rf resultsFile-master
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/resultsFile.tar.gz
tar -zxf resultsFile.tar.gz && rm resultsFile.tar.gz ||exit 1
mv resultsFile-master resultsFile

View File

@ -1,38 +0,0 @@
#!/bin/bash
#
# Installs zlib for ocaml cryptokit
# Mon Jan 12 18:52:48 CET 2015
ZLIB="zlib-1.2.8"
ZLIB_URL="http://zlib.net/${ZLIB}.tar.gz"
# Check the QPACKAGE_ROOT directory
if [[ -z ${QPACKAGE_ROOT} ]]
then
echo "The QPACKAGE_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit 1
fi
cd ${QPACKAGE_ROOT}
cat > /tmp/main.c << EOF
int main () {}
EOF
gcc /tmp/main.c -lz
if [[ $? -eq 0 ]]
then
rm /tmp/main.c "a.out"
exit 0
fi
rm /tmp/main.c
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py ${ZLIB_URL} ZLIB.tar.gz
tar -zxf ZLIB.tar.gz && rm ZLIB.tar.gz ||exit 1
cd ${ZLIB} || exit 1
./configure && make
make install prefix=$QPACKAGE_ROOT
cd ${QPACKAGE_ROOT}
rm -rf -- ${ZLIB}

View File

@ -6,15 +6,15 @@
# #
# Check the QPACKAGE_ROOT directory # Check the QP_ROOT directory
if [[ -z ${QPACKAGE_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
echo "The QPACKAGE_ROOT environment variable is not set." echo "The QP_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file." echo "Please reload the quantum_package.rc file."
exit 1 exit 1
fi fi
cd ${QPACKAGE_ROOT} cd ${QP_ROOT}
if [[ -f quantum_package.rc \ if [[ -f quantum_package.rc \
&& -f README.md \ && -f README.md \
&& -d src \ && -d src \
@ -35,7 +35,7 @@ fi
# Build all sources # Build all sources
for dir in ${QPACKAGE_ROOT}/{src,ocaml} for dir in ${QP_ROOT}/{src,ocaml}
do do
make -C ${dir} make -C ${dir}
if [[ $? -ne 0 ]] if [[ $? -ne 0 ]]
@ -46,7 +46,7 @@ done
# Copy the files in the static directory # Copy the files in the static directory
QPACKAGE_STATIC=${QPACKAGE_ROOT}/quantum_package_static QPACKAGE_STATIC=${QP_ROOT}/quantum_package_static
function find_libs () function find_libs ()
{ {
@ -58,7 +58,7 @@ function find_libs ()
function find_exec () function find_exec ()
{ {
find ${QPACKAGE_ROOT}/$1 -perm /u+x -type f find ${QP_ROOT}/$1 -perm /u+x -type f
} }
@ -111,12 +111,12 @@ cd -
for i in ${FORTRAN_EXEC} for i in ${FORTRAN_EXEC}
do do
i=$(basename $i) i=$(basename $i)
echo $i \$QPACKAGE_ROOT/bin/$i echo $i \$QP_ROOT/bin/$i
done >> ${QPACKAGE_STATIC}/data/executables done >> ${QPACKAGE_STATIC}/data/executables
cp ${QPACKAGE_ROOT}/data/ezfio_defaults ${QPACKAGE_STATIC}/data cp ${QP_ROOT}/data/ezfio_defaults ${QPACKAGE_STATIC}/data
mkdir -p ${QPACKAGE_STATIC}/src/Bitmask mkdir -p ${QPACKAGE_STATIC}/src/Bitmask
cp ${QPACKAGE_ROOT}/src/Bitmask/bitmasks_module.f90 ${QPACKAGE_STATIC}/src/Bitmask cp ${QP_ROOT}/src/Bitmask/bitmasks_module.f90 ${QPACKAGE_STATIC}/src/Bitmask
# #
echo "Copying dynamic libraries" echo "Copying dynamic libraries"
@ -143,10 +143,10 @@ cp -- ${QPACKAGE_STATIC}/extra_lib/lib{[gi]omp*,mkl*,lapack*,blas*,z*} ${QPACKAG
echo "Copying EMSL_Basis directory" echo "Copying EMSL_Basis directory"
# ---------------------------- # ----------------------------
cp -r -- ${QPACKAGE_ROOT}/EMSL_Basis ${QPACKAGE_STATIC}/ cp -r -- ${QP_ROOT}/EMSL_Basis ${QPACKAGE_STATIC}/
if [[ $? -ne 0 ]] ; if [[ $? -ne 0 ]] ;
then then
echo 'cp -r -- ${QPACKAGE_ROOT}/EMSL_Basis ${QPACKAGE_STATIC}/' echo 'cp -r -- ${QP_ROOT}/EMSL_Basis ${QPACKAGE_STATIC}/'
exit 1 exit 1
fi fi
@ -155,10 +155,10 @@ fi
echo "Copying scripts directory" echo "Copying scripts directory"
# ------------------------- # -------------------------
cp -r -- ${QPACKAGE_ROOT}/scripts ${QPACKAGE_STATIC}/ cp -r -- ${QP_ROOT}/scripts ${QPACKAGE_STATIC}/
if [[ $? -ne 0 ]] ; if [[ $? -ne 0 ]] ;
then then
echo 'cp -r -- ${QPACKAGE_ROOT}/scripts ${QPACKAGE_STATIC}/' echo 'cp -r -- ${QP_ROOT}/scripts ${QPACKAGE_STATIC}/'
exit 1 exit 1
fi fi
@ -168,13 +168,13 @@ echo "Creating quantum_package.rc"
# --------------------------- # ---------------------------
cat << EOF > ${QPACKAGE_STATIC}/quantum_package.rc cat << EOF > ${QPACKAGE_STATIC}/quantum_package.rc
export QPACKAGE_ROOT=\$( cd \$(dirname "\${BASH_SOURCE}") ; pwd -P ) export QP_ROOT=\$( cd \$(dirname "\${BASH_SOURCE}") ; pwd -P )
export LD_LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LD_LIBRARY_PATH} export LD_LIBRARY_PATH="\${QP_ROOT}"/lib:\${LD_LIBRARY_PATH}
export LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LIBRARY_PATH} export LIBRARY_PATH="\${QP_ROOT}"/lib:\${LIBRARY_PATH}
export PYTHONPATH="\${QPACKAGE_ROOT}"/scripts:\${PYTHONPATH} export PYTHONPATH="\${QP_ROOT}"/scripts:\${PYTHONPATH}
export PATH="\${QPACKAGE_ROOT}"/scripts:\${PATH} export PATH="\${QP_ROOT}"/scripts:\${PATH}
export PATH="\${QPACKAGE_ROOT}"/bin:\${PATH} export PATH="\${QP_ROOT}"/bin:\${PATH}
export PATH="\${QPACKAGE_ROOT}"/ocaml:\${PATH} export PATH="\${QP_ROOT}"/ocaml:\${PATH}
EOF EOF
#exit 0 #exit 0

View File

@ -2,13 +2,13 @@
# #
# Cleans a module directory # Cleans a module directory
if [[ -z ${QPACKAGE_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
print "The QPACKAGE_ROOT environment variable is not set." print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file." print "Please reload the quantum_package.rc file."
exit -1 exit -1
fi fi
source ${QPACKAGE_ROOT}/scripts/qp_include.sh source ${QP_ROOT}/scripts/qp_include.sh
function do_clean() function do_clean()
{ {

View File

@ -2,20 +2,20 @@
# #
# Thu Mar 26 01:27:14 CET 2015 # Thu Mar 26 01:27:14 CET 2015
if [[ -z ${QPACKAGE_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
print "The QPACKAGE_ROOT environment variable is not set." print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file." print "Please reload the quantum_package.rc file."
exit -1 exit -1
fi fi
cd ${QPACKAGE_ROOT}/data cd ${QP_ROOT}/data
rm -f executables rm -f executables
EXES=$(find ${QPACKAGE_ROOT}/src -perm /u+x -type f | grep -e "${QPACKAGE_ROOT}/src/[^/]*/[^/]*$" |sort ) EXES=$(find ${QP_ROOT}/src -perm /u+x -type f | grep -e "${QP_ROOT}/src/[^/]*/[^/]*$" |sort )
for EXE in $EXES for EXE in $EXES
do do
printf "%-30s %s\n" $(basename $EXE) $EXE | sed "s|${QPACKAGE_ROOT}|\$QPACKAGE_ROOT|g" >> executables printf "%-30s %s\n" $(basename $EXE) $EXE | sed "s|${QP_ROOT}|\$QP_ROOT|g" >> executables
done done

View File

@ -5,13 +5,13 @@
# Tue Jan 13 14:18:05 CET 2015 # Tue Jan 13 14:18:05 CET 2015
# #
if [[ -z ${QPACKAGE_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
print "The QPACKAGE_ROOT environment variable is not set." print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file." print "Please reload the quantum_package.rc file."
exit -1 exit -1
fi fi
source ${QPACKAGE_ROOT}/scripts/qp_include.sh source ${QP_ROOT}/scripts/qp_include.sh
function do_gitingore() function do_gitingore()

View File

@ -30,13 +30,13 @@ except ImportError:
# Canot cache for namedtuple are not hashable # Canot cache for namedtuple are not hashable
def get_dict_child(): def get_dict_child():
"""Loop over MODULE in QPACKAGE_ROOT/src, open all the NEEDED_CHILDREN_MODULES """Loop over MODULE in QP_ROOT/src, open all the NEEDED_CHILDREN_MODULES
and create a dict[MODULE] = [sub module needed, ...] and create a dict[MODULE] = [sub module needed, ...]
""" """
d_ref = dict() d_ref = dict()
qpackage_root = os.environ['QPACKAGE_ROOT'] qp_root = os.environ['QP_ROOT']
dir_ = os.path.join(qpackage_root, 'src') dir_ = os.path.join(qp_root, 'src')
for o in os.listdir(dir_): for o in os.listdir(dir_):

View File

@ -61,7 +61,7 @@ if __name__ == '__main__':
elif arguments["create"]: elif arguments["create"]:
l_children = arguments["<children_module>"] l_children = arguments["<children_module>"]
qpackage_root = os.environ['QPACKAGE_ROOT'] qpackage_root = os.environ['QP_ROOT']
path = os.path.join(qpackage_root, "src", arguments["<name>"]) path = os.path.join(qpackage_root, "src", arguments["<name>"])
print "You will create the module:" print "You will create the module:"

View File

@ -2,7 +2,7 @@
import os import os
Pert_dir = os.environ["QPACKAGE_ROOT"]+"/src/Perturbation/" Pert_dir = os.environ["QP_ROOT"]+"/src/Perturbation/"
perturbations = [] perturbations = []

View File

@ -17,9 +17,9 @@ from docopt import docopt
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
qpackage_root = os.environ['QPACKAGE_ROOT'] qpackage_root = os.environ['QP_ROOT']
EZFIO = "{0}/EZFIO".format(qpackage_root) EZFIO = "{0}/install/EZFIO".format(qpackage_root)
sys.path = [EZFIO + "/Python"] + sys.path sys.path = [EZFIO + "/Python"] + sys.path
from ezfio import ezfio from ezfio import ezfio
@ -51,7 +51,7 @@ def get_pseudo_str(l_atom):
10.11238853 0 1.14052020 |1><1| 10.11238853 0 1.14052020 |1><1|
""" """
EMSL_root = "{0}/EMSL_Basis/".format(qpackage_root) EMSL_root = "{0}/install/emsl/".format(qpackage_root)
EMSL_path = "{0}/EMSL_api.py".format(EMSL_root) EMSL_path = "{0}/EMSL_api.py".format(EMSL_root)
db_path = "{0}/db/Pseudo.db".format(EMSL_root) db_path = "{0}/db/Pseudo.db".format(EMSL_root)

View File

@ -13,23 +13,23 @@ function unique_list()
function check_current_dir_is_src() function check_current_dir_is_src()
{ {
if [[ "${PWD}" == "${QPACKAGE_ROOT}/src" ]] if [[ "${PWD}" == "${QP_ROOT}/src" ]]
then then
return 0 return 0
else else
echo "Current directory should be \$QPACKAGE_ROOT/src" echo "Current directory should be \$QP_ROOT/src"
exit -1 exit -1
fi fi
} }
function check_current_dir_is_module() function check_current_dir_is_module()
{ {
# If the prefix ${QPACKAGE_ROOT}/src/ can be removed from $PWD, it means that # If the prefix ${QP_ROOT}/src/ can be removed from $PWD, it means that
# $PWD is somewhere below ${QPACKAGE_ROOT}/src/ so it is a module. # $PWD is somewhere below ${QP_ROOT}/src/ so it is a module.
# If the prefix ${QPACKAGE_ROOT}/src/ can not be removed from $PWD, then # If the prefix ${QP_ROOT}/src/ can not be removed from $PWD, then
# "${PWD##${QPACKAGE_ROOT}/src/}" == "$PWD". # "${PWD##${QP_ROOT}/src/}" == "$PWD".
if [[ "${PWD##${QPACKAGE_ROOT}/src/}" != "$PWD" ]] if [[ "${PWD##${QP_ROOT}/src/}" != "$PWD" ]]
then then
return 0 return 0
else else

View File

@ -3,7 +3,7 @@
import os import os
import sys import sys
sys.path = [ os.environ["QPACKAGE_ROOT"]+"/EZFIO/Python" ] + sys.path sys.path = [ os.environ["QP_ROOT"]+"/EZFIO/Python" ] + sys.path
from ezfio import ezfio from ezfio import ezfio
ezfio.set_filename(sys.argv[1]) ezfio.set_filename(sys.argv[1])

View File

@ -4,9 +4,9 @@
# directory, where xxx is the corresponding mo_label. # directory, where xxx is the corresponding mo_label.
# Wed Apr 2 14:35:15 CEST 2014 # Wed Apr 2 14:35:15 CEST 2014
if [[ -z ${QPACKAGE_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
print "The QPACKAGE_ROOT environment variable is not set." print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file." print "Please reload the quantum_package.rc file."
exit -1 exit -1
fi fi

View File

@ -3,24 +3,24 @@
# Upgrades the EZFIO library from the web. # Upgrades the EZFIO library from the web.
# Tue Nov 4 00:53:13 CET 2014 # Tue Nov 4 00:53:13 CET 2014
if [[ -z ${QPACKAGE_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
print "The QPACKAGE_ROOT environment variable is not set." print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file." print "Please reload the quantum_package.rc file."
fi fi
cd -- ${QPACKAGE_ROOT} cd -- ${QP_ROOT}
mv -- ${QPACKAGE_ROOT}/EZFIO ${QPACKAGE_ROOT}/EZFIO.old mv -- ${QP_ROOT}/EZFIO ${QP_ROOT}/EZFIO.old
${QPACKAGE_ROOT}/scripts/install/install_ezfio.sh ${QP_ROOT}/scripts/install/install_ezfio.sh
if [[ $? -eq 0 ]] if [[ $? -eq 0 ]]
then then
rm -rf -- ${QPACKAGE_ROOT}/EZFIO.old rm -rf -- ${QP_ROOT}/EZFIO.old
echo "Successfully updated EZFIO" echo "Successfully updated EZFIO"
else else
rm -rf -- ${QPACKAGE_ROOT}/EZFIO rm -rf -- ${QP_ROOT}/EZFIO
mv -- ${QPACKAGE_ROOT}/EZFIO.old ${QPACKAGE_ROOT}/EZFIO mv -- ${QP_ROOT}/EZFIO.old ${QP_ROOT}/EZFIO
echo "Failed to update EZFIO" echo "Failed to update EZFIO"
fi fi

View File

@ -3,23 +3,23 @@
# Upgrades IRPF90 from the web. # Upgrades IRPF90 from the web.
# Wed Mar 25 11:41:04 CET 2015 # Wed Mar 25 11:41:04 CET 2015
if [[ -z ${QPACKAGE_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
print "The QPACKAGE_ROOT environment variable is not set." print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file." print "Please reload the quantum_package.rc file."
fi fi
cd -- ${QPACKAGE_ROOT} cd -- ${QP_ROOT}
mv -f -- ${QPACKAGE_ROOT}/irpf90 ${QPACKAGE_ROOT}/irpf90.old mv -f -- ${QP_ROOT}/irpf90 ${QP_ROOT}/irpf90.old
${QPACKAGE_ROOT}/scripts/install/install_irpf90.sh ${QP_ROOT}/scripts/install/install_irpf90.sh
if [[ $? -eq 0 ]] if [[ $? -eq 0 ]]
then then
rm -rf -- ${QPACKAGE_ROOT}/irpf90.old rm -rf -- ${QP_ROOT}/irpf90.old
echo "Successfully updated IRPF90" echo "Successfully updated IRPF90"
else else
rm -rf -- ${QPACKAGE_ROOT}/irpf90 rm -rf -- ${QP_ROOT}/irpf90
mv -- ${QPACKAGE_ROOT}/irpf90.old ${QPACKAGE_ROOT}/irpf90 mv -- ${QP_ROOT}/irpf90.old ${QP_ROOT}/irpf90
echo "Failed to update IRPF90" echo "Failed to update IRPF90"
fi fi

383
setup_environment.py Executable file
View File

@ -0,0 +1,383 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import os
import sys
import pprint
from os.path import join
# __ _
# /__ | _ |_ _. | o ._ _|_ _
# \_| |_ (_) |_) (_| | | | | | (_)
#
QP_ROOT = os.getcwd()
QP_ROOT_BIN = join(QP_ROOT, "bin")
QP_ROOT_INSTALL = join(QP_ROOT, "install")
d_dependancy = {
"ocaml": ["m4", "curl", "zlib", "patch", "gcc"],
"m4": ["make"],
"curl": ["make"],
"zlib": ["gcc", "make"],
"patch": ["make"],
"ezfio": ["irpf90"],
"irpf90": ["python"],
"docopt": ["python"],
"resultsFile": ["python"],
"emsl": ["python"],
"gcc": [],
"python": [],
"ninja": ["gcc", "python"],
"make": []
}
from collections import namedtuple
Info = namedtuple("Info", ["url", "description", "default_path"])
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 (it will take some time roughly 20min)',
default_path=join(QP_ROOT_BIN, "opam"))
m4 = Info(
url="http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz",
description=" m4",
default_path=join(QP_ROOT_BIN, "m4"))
curl = Info(
url="http://qmcchem.ups-tlse.fr/files/scemama/curl-7.30.0.ermine.tar.bz2",
description=" curl",
default_path=join(QP_ROOT_BIN, "curl"))
zlib = Info(
url='http://zlib.net/zlib-1.2.8.tar.gz',
description=' zlib',
default_path=join(QP_ROOT_INSTALL, "zlib"))
path = Info(
url='ftp://ftp.gnu.org/gnu/patch/patch-2.7.5.tar.gz',
description=' path',
default_path=join(QP_ROOT_BIN, "patch"))
irpf90 = Info(
url='{head}/scemama/irpf90/archive/v1.6.6.tar.gz'.format(**path_github),
description=' irpf90',
default_path=join(QP_ROOT_BIN, "irpf90"))
docopt = Info(
url='{head}/docopt/docopt/{tail}'.format(**path_github),
description=' docop',
default_path=join(QP_ROOT_INSTALL, "docopt"))
resultsFile = Info(
url='{head}/LCPQ/resultsFile/{tail}'.format(**path_github),
description=' resultsFile',
default_path=join(QP_ROOT_INSTALL, "resultsFile"))
ninja = Info(
url='{head}/martine/ninja/{tail}'.format(**path_github),
description=' nina',
default_path=join(QP_ROOT_BIN, "ninja"))
emsl = Info(
url='{head}/LCPQ/EMSL_Basis_Set_Exchange_Local/{tail}'.format(**
path_github),
description=' emsl',
default_path=join(QP_ROOT_INSTALL, "emsl"))
ezfio = Info(
url='{head}/LCPQ/EZFIO/{tail}'.format(**path_github),
description=' EZFIO',
default_path=join(QP_ROOT_INSTALL, "EZFIO"))
d_info = dict()
for m in ["ocaml", "m4", "curl", "zlib", "path", "irpf90", "docopt",
"resultsFile", "ninja", "emsl", "ezfio"]:
exec ("d_info['{0}']={0}".format(m))
l_need = []
# _
# |_ ._ _ _|_ o _ ._
# | |_| | | (_ |_ | (_) | |
#
def check_output(*popenargs, **kwargs):
"""Run command with arguments and return its output as a byte string.
Backported from Python 2.7 as it's implemented as pure python on stdlib.
>>> check_output(['/usr/bin/python', '--version'])
Python 2.6.2
"""
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
output, unused_err = process.communicate()
retcode = process.poll()
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
error = subprocess.CalledProcessError(retcode, cmd)
error.output = output
raise error
return output
def check_python():
req_version = (2, 6)
cur_version = sys.version_info
# Check python
if cur_version >= req_version:
l_installed["python"] = ""
else:
print "To old version (need >2.5). Abort"
sys.exit(1)
def check_avabiliy(binary):
if binary == "python":
check_python()
try:
return check_output(["which", binary])
except subprocess.CalledProcessError:
default_path = d_info[binary].default_path
if os.path.exists(default_path):
return default_path
else:
return 0
def splitext(path):
for ext in ['.tar.gz', '.tar.bz2']:
if path.endswith(ext):
return path[:-len(ext)], path[-len(ext):]
return os.path.splitext(path)
l_installed = dict()
print """
_
/ |_ _ _ | o ._ _
\_ | | (/_ (_ |< | | | (_|
_|
"""
# Check all the other
for i in d_dependancy.keys():
print "Checking if you have {0} avalaible...".format(i),
r = check_avabiliy(i)
if r:
print "OK"
l_installed[i] = r.strip()
else:
print "We will try to compile if from source in a few moment"
l_need.append(i)
# Expend the need_stuff for all the genealogy
d_need_genealogy = dict()
for need in l_need:
d_need_genealogy[need] = None
for childen in d_dependancy[need]:
if childen not in l_installed:
d_need_genealogy[childen] = None
l_need_genealogy = d_need_genealogy.keys()
print """
__
(_ ._ _ ._ _ _. ._
__) |_| | | | | | | (_| | \/
/
"""
print "You have already installed :"
def f( (a1,a2), (key,value) ):
return tuple(max(x,len(y)) for (x,y) in [(a1,key), (a2,value)] )
fmt_tuple =reduce(f, l_installed.iteritems(), (0,0))
for k,v in l_installed.iteritems():
fmt = "{0:<%d} : {1:<%d}"%fmt_tuple
print fmt.format( k, v )
print """
___
| ._ _ _|_ _. | | _. _|_ o _ ._
_|_ | | _> |_ (_| | | (_| |_ | (_) | |
"""
if l_need_genealogy:
print "You need to install"
pprint.pprint(l_need_genealogy)
else:
print "Nothing to do"
sys.exit()
if "ninja" in l_need_genealogy:
print """
# ~#~#~#~#~#~#~#~#~#~#~#~#~ #
# I n s t a l l _ n i n j a #
# ~#~#~#~#~#~#~#~#~#~#~#~#~ #
"""
url = d_info["ninja"].url
extension = splitext(url)[1]
path_archive = "Downloads/{0}{1}".format("ninja", extension)
l_cmd = ["cd install &&",
"wget {0} -O {1} -o /dev/null &&".format(url, path_archive),
"./scripts/install_ninja.sh 2> /dev/null &&", "cd -"]
check_output(" ".join(l_cmd), shell=True)
print "Done"
l_need_genealogy.remove("ninja")
print """
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
# C r e a t i n g _ n i n j a #
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
"""
def create_rule():
l_rules = [
"rule download", " command = wget ${url} -O ${out} -o /dev/null",
" description = Downloading ${descr}", "", "rule install",
" command = ./scripts/install_${target}.sh > _build/${target}.log 2>&1",
" description = Installing ${descr}", ""
]
return l_rules
l_string = create_rule()
l_build = []
for need in l_need_genealogy:
if need == "ocaml":
continue
url = d_info[need].url
extension = splitext(url)[1]
archive_path = "Downloads/{0}{1}".format(need, extension)
descr = d_info[need].description
# Build to dowload
l_build += ["build {0}: download".format(archive_path),
" url = {0}".format(url),
" descr = {0}".format(descr), ""]
# Build to install
l_dependancy = [d_info[i].default_path for i in d_dependancy[need] if i in l_need_genealogy]
l_build += ["build {0}: install {1} {2}".format(d_info[need].default_path,
archive_path,
" ".join(l_dependancy)),
" target = {0}".format(need),
" descr = {0}".format(descr), ""]
l_string += l_build
path = join(QP_ROOT_INSTALL, "build.ninja")
with open(path, "w+") as f:
f.write("\n".join(l_string))
print "Done"
print "You can check at {0}".format(path)
print """
# ~#~#~#~#~#~#~#~#~ #
# R u n _ n i n j a #
# ~#~#~#~#~#~#~#~#~ #
"""
if [i for i in l_need_genealogy if i not in "ocaml"]:
subprocess.check_call("./bin/ninja -C install", shell=True)
print "Done"
if "ocaml" in l_need_genealogy:
print """
# ~#~#~#~#~#~#~#~#~#~#~#~#~ #
# I n s t a l l _ o c a m l #
# ~#~#~#~#~#~#~#~#~#~#~#~#~ #
"""
url = d_info["ocaml"].url
extension = splitext(url)[1]
path_archive = "Downloads/{0}{1}".format("ocaml", extension)
l_cmd = ["cd install &&",
"wget {0} -O {1} -o /dev/null &&".format(url, path_archive),
"./scripts/install_ocaml.sh --fast"]
os.system(" ".join(l_cmd))
print "Done"
l_need_genealogy.remove("ocaml")
print """
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
# C r e a t e q u a n t u m _ p a c k a g e . r c
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
"""
python_path = [join(QP_ROOT, "scripts"), join(QP_ROOT, "install")]
l_python = [join(QP_ROOT, "scripts")]
for dir_ in python_path:
for folder in os.listdir(dir_):
path = join(dir_, folder)
if os.path.isdir(path):
l_python.append(path)
def find_path(bin_):
try:
locate = l_installed[bin_]
except KeyError:
locate = d_info[bin_].default_path
return locate
l_rc = [
'export QP_ROOT={0}'.format(QP_ROOT),
'export QP_EZFIO={0}'.format(find_path('ezfio')),
'export IRPF90={0}'.format(find_path("irpf90")),
'export NINJA={0}'.format(find_path("ninja")),
'export QP_PYTHON={0}'.format(":".join(l_python)),
"",
'export PYTHONPATH="${PYTHONPATH}":"${QP_PYTHON}"',
'export PATH="${PATH}":"${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml',
'export LD_LIBRARY_PATH="${QP_ROOT}"/lib:"${LD_LIBRARY_PATH}"',
'export LIBRARY_PATH="${QP_ROOT}"/lib:"${LIBRARY_PATH}"', ""
'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:
f.write("\n".join(l_rc))
print "Done"
print "You can check at {0}".format(path)
print "Don't forget to source it"

View File

@ -1,116 +0,0 @@
#!/bin/bash
#
# Setup script. Downloads dependencies if they are not already present
# in the current installation.
# Thu Oct 23 22:02:08 CEST 2014
BLUE=""
RED=""
BLACK="(B"
QPACKAGE_ROOT="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )"
cat << EOF > quantum_package.rc
export QPACKAGE_ROOT=\$( cd \$(dirname "\${BASH_SOURCE}") ; pwd -P )
export IRPF90="\${QPACKAGE_ROOT}/bin/irpf90"
export LD_LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LD_LIBRARY_PATH}
export LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LIBRARY_PATH}
export C_INCLUDE_PATH="\${QPACKAGE_ROOT}"/include:\${C_INCLUDE_PATH}
export PYTHONPATH=\${PYTHONPATH}\$(find "\${QPACKAGE_ROOT}"/scripts -type d -printf ":%p")
export PATH=\${PATH}\$(find "\${QPACKAGE_ROOT}"/scripts -type d -printf ":%p")
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/bin
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/ocaml
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/ninja
source "\${QPACKAGE_ROOT}"/bin/irpman &> /dev/null
EOF
source quantum_package.rc
mkdir -p install_logs
echo "${BLUE}===== Installing IRPF90 ===== ${BLACK}"
${QPACKAGE_ROOT}/scripts/install/install_irpf90.sh | tee ${QPACKAGE_ROOT}/install_logs/install_irpf90.log
if [[ ! -d ${QPACKAGE_ROOT}/irpf90 ]] || [[ ! -x ${QPACKAGE_ROOT}/bin/irpf90 ]] || [[ ! -x ${QPACKAGE_ROOT}/bin/irpman ]]
then
echo $RED "Error in IRPF90 installation" $BLACK
exit 1
fi
mkdir -p ${QPACKAGE_ROOT}/install_logs
echo "${BLUE}===== Installing Ninja ===== ${BLACK}"
${QPACKAGE_ROOT}/scripts/install/install_ninja.sh | tee ${QPACKAGE_ROOT}/install_logs/install_ninja.log
echo "${BLUE}===== Installing Zlib ===== ${BLACK}"
${QPACKAGE_ROOT}/scripts/install/install_zlib.sh | tee ${QPACKAGE_ROOT}/install_logs/install_zlib.log
echo "${BLUE}===== Installing Curl ===== ${BLACK}"
${QPACKAGE_ROOT}/scripts/install/install_curl.sh | tee ${QPACKAGE_ROOT}/install_logs/install_curl.log
echo "${BLUE}===== Installing M4 ===== ${BLACK}"
${QPACKAGE_ROOT}/scripts/install/install_m4.sh | tee ${QPACKAGE_ROOT}/install_logs/install_m4.log
echo "${BLUE}===== Installing Docopt ===== ${BLACK}"
${QPACKAGE_ROOT}/scripts/install/install_docopt.sh | tee ${QPACKAGE_ROOT}/install_logs/install_docopt.log
echo "${BLUE}===== Installing EMSL Basis set library ===== ${BLACK}"
${QPACKAGE_ROOT}/scripts/install/install_emsl.sh | tee ${QPACKAGE_ROOT}/install_logs/install_emsl.log
if [[ ! -d ${QPACKAGE_ROOT}/EMSL_Basis ]]
then
echo $RED "Error in EMSL Basis set library installation" $BLACK
exit 1
fi
echo "${BLUE}===== Installing EZFIO ===== ${BLACK}"
${QPACKAGE_ROOT}/scripts/install/install_ezfio.sh | tee ${QPACKAGE_ROOT}/install_logs/install_ezfio.log
if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]]
then
echo $RED "Error in EZFIO installation" $BLACK
exit 1
fi
echo "${BLUE}===== Installing Ocaml compiler and libraries ===== ${BLACK}"
rm -f -- ocaml/Qptypes.ml
${QPACKAGE_ROOT}/scripts/install/install_ocaml.sh | tee ${QPACKAGE_ROOT}/install_logs/install_ocaml.log
if [[ ! -f ${QPACKAGE_ROOT}/ocaml/Qptypes.ml ]]
then
echo $RED "Error in Ocaml installation" $BLACK
exit 1
fi
echo "${BLUE}===== Installing resultsFile Python library ===== ${BLACK}"
${QPACKAGE_ROOT}/scripts/install/install_resultsFile.sh
if [[ ! -d ${QPACKAGE_ROOT}/resultsFile ]]
then
echo $RED "Error in resultsFile installation" $BLACK
exit 1
fi
echo $RED "
=======================================================
To complete the installation, add the following line to
your ~/.bashrc:
source ${QPACKAGE_ROOT}/quantum_package.rc
=======================================================
" $BLACK
if [[ $1 == "--robot" ]] ;
then
exit 0
else
source quantum_package.rc
exec bash
fi

View File

@ -10,7 +10,7 @@ END_PROVIDER
BEGIN_SHELL [ /bin/bash ] BEGIN_SHELL [ /bin/bash ]
for NAME in $(\ls -d ${QPACKAGE_ROOT}/src/*/) for NAME in $(\ls -d ${QP_ROOT}/src/*/)
do do
NAME=$(basename ${NAME}) NAME=$(basename ${NAME})
cat << EOF cat << EOF

View File

@ -3,7 +3,7 @@ subroutine save_mos
double precision, allocatable :: buffer(:,:) double precision, allocatable :: buffer(:,:)
integer :: i,j integer :: i,j
call system('$QPACKAGE_ROOT/scripts/save_current_mos.sh '//trim(ezfio_filename)) call system('$QP_ROOT/scripts/save_current_mos.sh '//trim(ezfio_filename))
call ezfio_set_mo_basis_mo_tot_num(mo_tot_num) call ezfio_set_mo_basis_mo_tot_num(mo_tot_num)
call ezfio_set_mo_basis_mo_label(mo_label) call ezfio_set_mo_basis_mo_label(mo_label)

View File

@ -2,7 +2,7 @@ BEGIN_SHELL [ /usr/bin/env python ]
from perturbation import perturbations from perturbation import perturbations
import os import os
filename = os.environ["QPACKAGE_ROOT"]+"/src/Perturbation/perturbation.template.f" filename = os.environ["QP_ROOT"]+"/src/Perturbation/perturbation.template.f"
file = open(filename,'r') file = open(filename,'r')
template = file.read() template = file.read()
file.close() file.close()

View File

@ -31,7 +31,7 @@ Creating a new module
===================== =====================
Every new module should be created using the interactive ``create_module.sh`` Every new module should be created using the interactive ``create_module.sh``
script located in the ``${QPACKAGE_ROOT}/scripts`` directory. This will create script located in the ``${QP_ROOT}/scripts`` directory. This will create
all the required files with correct templates. all the required files with correct templates.
@ -88,7 +88,7 @@ HTML, man, etc.
Creating a shell script Creating a shell script
======================= =======================
Shell scripts should be located in the ``${QPACKAGE_ROOT}/scripts`` directory. Shell scripts should be located in the ``${QP_ROOT}/scripts`` directory.
Relative paths should be avoided as much as possible, and the result of commands Relative paths should be avoided as much as possible, and the result of commands
should be always checked. For example, when creating a directory the existence 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.

View File

@ -5,9 +5,9 @@ import subprocess
import os import os
import sys import sys
qpackage_root = os.environ['QPACKAGE_ROOT'] qpackage_root = os.environ['QP_ROOT']
EZFIO = "{0}/EZFIO".format(qpackage_root) EZFIO = "{0}/install/EZFIO".format(qpackage_root)
sys.path = [EZFIO + "/Python"] + sys.path sys.path = [EZFIO + "/Python"] + sys.path
from ezfio import ezfio from ezfio import ezfio