Simplify code building and package creation.
This commit is contained in:
parent
e2ec1e8bcd
commit
4702d0cb0c
|
@ -5,7 +5,11 @@ __pycache__
|
||||||
*.mod
|
*.mod
|
||||||
*.bak
|
*.bak
|
||||||
*.target
|
*.target
|
||||||
|
*.sconsign.dblite
|
||||||
htmlcov
|
htmlcov
|
||||||
package/
|
package/
|
||||||
src/msspec/results.txt
|
src/msspec/results.txt
|
||||||
*venv/
|
*venv/
|
||||||
|
**/*build/
|
||||||
|
**/*dist/
|
||||||
|
**/*.egg-info/
|
||||||
|
|
83
Makefile
83
Makefile
|
@ -1,83 +0,0 @@
|
||||||
MAKESELF:=makeself
|
|
||||||
VERSION:=$(shell git describe|sed 's/-\([[:digit:]]\+\)-.*/\.post\1/')
|
|
||||||
SETUPFILE:=MsSpec-$(VERSION).setup
|
|
||||||
|
|
||||||
|
|
||||||
VERBOSE:=0
|
|
||||||
ifeq ($(VERBOSE),0)
|
|
||||||
SUPPRESS_OUPUT:=1>/dev/null 2>/dev/null
|
|
||||||
MAKEFLAGS += --no-print-directory
|
|
||||||
else
|
|
||||||
SUPPRESS_OUPUT:=
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean version selfex venv doc
|
|
||||||
|
|
||||||
|
|
||||||
selfex: results
|
|
||||||
@echo "Creating the self-extractible setup program... "
|
|
||||||
# copy the src folder and purge it
|
|
||||||
@cp -r src src_
|
|
||||||
@+$(MAKE) -C ./src_ purge
|
|
||||||
# update the version
|
|
||||||
@echo "$(VERSION)" > ./src_/VERSION
|
|
||||||
# distribute the README.md file
|
|
||||||
@cp README.md ./src_/
|
|
||||||
# create the package folder
|
|
||||||
@mkdir -p package
|
|
||||||
# create the *.lsm file
|
|
||||||
@echo "Begin4" > msspec.lsm
|
|
||||||
@echo "Title: Python MsSpec" >> msspec.lsm
|
|
||||||
@echo "Version: $(VERSION)" >> msspec.lsm
|
|
||||||
@echo "Entered-date: `date +%Y-%m-%d`" >> msspec.lsm
|
|
||||||
@echo "Description: A multiple scattering package for spectroscopies using electrons to probe materials" >> msspec.lsm
|
|
||||||
@echo "Keywords: " >> msspec.lsm
|
|
||||||
@echo "Author: sylvain.tricot@univ-rennes1.fr (Sylvain Tricot), didier.sebilleau@univ-rennes1.fr (Didier Sébilleau)" >> msspec.lsm
|
|
||||||
@echo "Maintained-by: sylvain.tricot@univ-rennes1.fr (Sylvain Tricot)" >> msspec.lsm
|
|
||||||
@echo "Primary-site: https://msspec.cnrs.fr" >> msspec.lsm
|
|
||||||
@echo "Alternate-site:" >> msspec.lsm
|
|
||||||
@echo "Original-site:" >> msspec.lsm
|
|
||||||
@echo "Platforms:" >> msspec.lsm
|
|
||||||
@echo "Copying-policy: Gnu Library General Public License (GLPL) 2.0" >> msspec.lsm
|
|
||||||
@echo "End" >> msspec.lsm
|
|
||||||
# create the self-extractible archive
|
|
||||||
@$(MAKESELF) --license "./license.txt" --lsm ./msspec.lsm ./src_ package/$(SETUPFILE) "Python MsSpec" ./install.sh $(SUPPRESS_OUPUT)
|
|
||||||
# remove *.lsm file and src_
|
|
||||||
@rm ./msspec.lsm
|
|
||||||
@rm -rf ./src_
|
|
||||||
|
|
||||||
|
|
||||||
version:
|
|
||||||
@python ./CI/update_version.py
|
|
||||||
|
|
||||||
|
|
||||||
clean:
|
|
||||||
@echo "Cleaning all..."
|
|
||||||
@find ./src -type f -name '*.pyc' -exec rm -f {} +
|
|
||||||
@find ./src -type d -name '__pycache__' -exec rm -rf {} +
|
|
||||||
@rm -rf src/dist
|
|
||||||
@rm -rf src/*.egg*
|
|
||||||
@+$(MAKE) -C src/ clean $(SUPPRESS_OUPUT)
|
|
||||||
@+$(MAKE) -C doc/ clean $(SUPPRESS_OUPUT)
|
|
||||||
@rm -rf package
|
|
||||||
|
|
||||||
purge: clean
|
|
||||||
@echo "Removing also shared objects..."
|
|
||||||
@find ./src -type f -name '*.so' -exec rm -f {} +
|
|
||||||
|
|
||||||
results:
|
|
||||||
@+$(MAKE) -C src results
|
|
||||||
|
|
||||||
|
|
||||||
venv:
|
|
||||||
@virtualenv --python=python3 --system-site-packages ci_venv $(SUPPRESS_OUPUT)
|
|
||||||
@. "./ci_venv/bin/activate" && pip install --upgrade pip && pip install --upgrade -r requirements.txt $(SUPPRESS_OUPUT)
|
|
||||||
|
|
||||||
doc:
|
|
||||||
@echo "Building pdf and html documentation..."
|
|
||||||
@mkdir -p package/
|
|
||||||
@+$(MAKE) -C doc/ latexpdf $(SUPPRESS_OUPUT)
|
|
||||||
@rm -rf package/*.pdf
|
|
||||||
@cp "doc/build/latex/MsSpec-python.pdf" "./package/MsSpec-${VERSION}.pdf"
|
|
||||||
@+$(MAKE) -C doc/ html $(SUPPRESS_OUPUT)
|
|
|
@ -1,4 +1,3 @@
|
||||||
recursive-include msspec *.f
|
recursive-include msspec *.so
|
||||||
recursive-include msspec *.inc
|
|
||||||
recursive-include . SConstruct
|
recursive-include . SConstruct
|
||||||
include requirements.txt
|
include requirements.txt
|
||||||
|
|
60
src/Makefile
60
src/Makefile
|
@ -1,60 +0,0 @@
|
||||||
VERSION:=$(shell python -c "import msspec; print(msspec.__version__)")
|
|
||||||
|
|
||||||
VERBOSE:=0
|
|
||||||
ifeq ($(VERBOSE),0)
|
|
||||||
SUPPRESS_OUPUT:=1>/dev/null 2>/dev/null
|
|
||||||
MAKEFLAGS += --no-print-directory --silent
|
|
||||||
else
|
|
||||||
SUPPRESS_OUPUT:=
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
install: sdist
|
|
||||||
@echo "Installing the newly created Python package..."
|
|
||||||
@pip install dist/msspec-*.tar.gz $(SUPPRESS_OUPUT)
|
|
||||||
|
|
||||||
sdist: install_deps
|
|
||||||
@echo "Creating Python source distribution..."
|
|
||||||
# Create the source distrib
|
|
||||||
@python setup.py sdist $(SUPPRESS_OUPUT)
|
|
||||||
|
|
||||||
install_deps: pybinding
|
|
||||||
@echo "Installing Python dependencies..."
|
|
||||||
# Install dependencies with pip
|
|
||||||
@pip install --upgrade -r requirements.txt $(SUPPRESS_OUPUT)
|
|
||||||
|
|
||||||
pybinding:
|
|
||||||
@echo "Building Python binding for phagen and spec..."
|
|
||||||
@+$(MAKE) -C msspec/spec/fortran pybinding $(SUPPRESS_OUPUT)
|
|
||||||
@+$(MAKE) -C msspec/phagen/fortran pybinding $(SUPPRESS_OUPUT)
|
|
||||||
|
|
||||||
results: msspec/results.txt
|
|
||||||
|
|
||||||
msspec/results.txt: pybinding
|
|
||||||
@echo "Generating results for unittests"
|
|
||||||
@coverage run --source=./ --omit=msspec/es/*,msspec/msspecgui/* msspec/create_tests_results.py 1>/dev/null
|
|
||||||
# create the html coverage report
|
|
||||||
@coverage html -d ../doc/source/htmlcov
|
|
||||||
@rm .coverage
|
|
||||||
|
|
||||||
tests: pybinding
|
|
||||||
@echo "Runing unittests"
|
|
||||||
@python -m msspec.tests 1>/dev/null
|
|
||||||
|
|
||||||
clean:
|
|
||||||
@echo "Cleaning all..."
|
|
||||||
@find ./ -type f -name '*.pyc' -exec rm -f {} +
|
|
||||||
@find ./ -type d -name '__pycache__' -exec rm -rf {} +
|
|
||||||
@+$(MAKE) -C msspec/spec/fortran clean $(SUPPRESS_OUPUT)
|
|
||||||
@+$(MAKE) -C msspec/phagen/fortran clean $(SUPPRESS_OUPUT)
|
|
||||||
# remove previous sdist
|
|
||||||
@rm -rf dist
|
|
||||||
@rm -rf *.egg*
|
|
||||||
|
|
||||||
purge: clean
|
|
||||||
@echo "Removing also shared objects..."
|
|
||||||
@find ./ -type f -name '*.so' -exec rm -f {} +
|
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "help message"
|
|
||||||
|
|
104
src/SConstruct
104
src/SConstruct
|
@ -1,6 +1,47 @@
|
||||||
from sysconfig import get_config_var
|
from sysconfig import get_config_var
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
suffix = get_config_var('EXT_SUFFIX')
|
||||||
|
|
||||||
|
def filtered_glob(env, pattern, omit=[],
|
||||||
|
ondisk=True, source=False, strings=False):
|
||||||
|
return list(filter(
|
||||||
|
lambda f: os.path.basename(f.path) not in omit,
|
||||||
|
env.Glob(pattern)))
|
||||||
|
|
||||||
|
# Create a builder for f2py
|
||||||
|
def f2py_generator(source, target, env, for_signature):
|
||||||
|
main = source[0]
|
||||||
|
objects = " ".join(o.get_path() for o in source[1:] if str(o).endswith('.o'))
|
||||||
|
modulename = str(target[0]).replace(suffix, '').replace('/', '.')
|
||||||
|
compiler = env['FORTRAN']
|
||||||
|
cmd = f"f2py3 --fcompiler={compiler} "
|
||||||
|
cmd += f" $F2PY_OPTS -m {modulename} -c {objects} {main}"
|
||||||
|
#cmd += " 1>/dev/null 2>/dev/null"
|
||||||
|
return cmd
|
||||||
|
|
||||||
|
def f2py_emitter(target, source, env):
|
||||||
|
""" used to add the correct cpython .so suffix to the modulename """
|
||||||
|
target[0] = str(target[0]).replace('.', '/') + suffix
|
||||||
|
return target, source
|
||||||
|
|
||||||
|
def install_module(env, module):
|
||||||
|
destdir = os.path.dirname(module[0].srcnode().abspath)
|
||||||
|
env.Install(destdir, module)
|
||||||
|
env.Alias('install', destdir)
|
||||||
|
return None
|
||||||
|
|
||||||
|
f2py_bld = Builder(generator=f2py_generator, emitter=f2py_emitter)
|
||||||
|
|
||||||
|
# define the default build environment
|
||||||
|
std = Environment(tools=['default', 'fortran'], F2PY_OPTS=[], LIBS=[])
|
||||||
|
std.AddMethod(filtered_glob, "FilteredGlob")
|
||||||
|
std.AddMethod(install_module, "InstallModule")
|
||||||
|
std['BUILDERS']['F2py'] = f2py_bld
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
# Define the command line options
|
# Define the command line options
|
||||||
AddOption('--dbg',
|
AddOption('--dbg',
|
||||||
dest='dbg',
|
dest='dbg',
|
||||||
|
@ -18,39 +59,19 @@ AddOption('--compiler',
|
||||||
choices=['gfortran', 'ifort'],
|
choices=['gfortran', 'ifort'],
|
||||||
help='The Fortran compiler to use')
|
help='The Fortran compiler to use')
|
||||||
|
|
||||||
def CheckPKGConfig(context, version):
|
|
||||||
context.Message( 'Checking for pkg-config... ' )
|
|
||||||
ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
|
|
||||||
context.Result( ret )
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def CheckPKG(context, name):
|
|
||||||
context.Message( 'Checking for %s... ' % name )
|
|
||||||
ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
|
|
||||||
context.Result( ret )
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def filtered_glob(env, pattern, omit=[],
|
|
||||||
ondisk=True, source=False, strings=False):
|
|
||||||
return list(filter(
|
|
||||||
lambda f: os.path.basename(f.path) not in omit,
|
|
||||||
env.Glob(pattern)))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# define the default build environment
|
|
||||||
std = Environment(tools=['default', 'fortran'], F2PY_OPTS=[], FORTRANCOMSTR = "building $TARGET ...", LIBS=[])
|
|
||||||
std.AddMethod(filtered_glob, "FilteredGlob");
|
|
||||||
|
|
||||||
# define environments
|
# define environments
|
||||||
gfortran_env = std.Clone(tools=['gfortran'])
|
gfortran_env = std.Clone(tools=['gfortran'])
|
||||||
gfortran_env.Replace(FORTRANFLAGS=['-fPIC', '-O2', '-ffast-math', '-fno-automatic'])
|
gfortran_env.Replace(FORTRANFLAGS=['-fPIC', '-O2', '-ffast-math'])
|
||||||
|
|
||||||
ifort_env = std.Clone(tools=['ifort'])
|
ifort_env = std.Clone(tools=['ifort'])
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
if GetOption('compiler') == 'gfortran':
|
if GetOption('compiler') == 'gfortran':
|
||||||
env = gfortran_env
|
env = gfortran_env
|
||||||
|
env.Append(F2PY_OPTS='--opt=-O2')
|
||||||
elif GetOption('compiler') == 'ifort':
|
elif GetOption('compiler') == 'ifort':
|
||||||
env = ifort_env
|
env = ifort_env
|
||||||
|
|
||||||
|
@ -65,37 +86,6 @@ if GetOption('verbose'):
|
||||||
env.Replace(FORTRANCOMSTR = "")
|
env.Replace(FORTRANCOMSTR = "")
|
||||||
|
|
||||||
|
|
||||||
conf = Configure(env, custom_tests = { 'CheckPKG' : CheckPKG})
|
Export('env')
|
||||||
suffix = get_config_var('EXT_SUFFIX')
|
SConscript('msspec/spec/fortran/SConstruct', variant_dir='build/build_spec')
|
||||||
|
SConscript('msspec/phagen/fortran/SConstruct', variant_dir='build/build_phagen')
|
||||||
# Create a builder for f2py
|
|
||||||
def create_f2py_cmd(source, target, env, for_signature):
|
|
||||||
objects = source[1:]
|
|
||||||
cmd = "f2py3 "
|
|
||||||
cmd += " ".join([o.get_path() for o in objects if str(o).endswith('o')])
|
|
||||||
cmd += f" $F2PY_OPTS -m {str(target[0]).replace(suffix,'').replace('/', '.')} -c {source[0]}"
|
|
||||||
return cmd
|
|
||||||
|
|
||||||
def modify_targets(target, source, env):
|
|
||||||
target[0] = str(target[0]) + suffix
|
|
||||||
#print(target[0])
|
|
||||||
return target, source
|
|
||||||
|
|
||||||
bld = Builder(generator=create_f2py_cmd, emitter = modify_targets)
|
|
||||||
env['BUILDERS']['F2PY'] = bld
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# exports
|
|
||||||
try:
|
|
||||||
Import('local_build')
|
|
||||||
except:
|
|
||||||
local_build = False
|
|
||||||
|
|
||||||
Export('env', 'conf')
|
|
||||||
|
|
||||||
print('local_build = ', local_build)
|
|
||||||
|
|
||||||
if not local_build:
|
|
||||||
SConscript(['msspec/spec/fortran/SConstruct',
|
|
||||||
'msspec/phagen/fortran/SConstruct'])
|
|
||||||
|
|
307
src/install.sh
307
src/install.sh
|
@ -1,307 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# vim: set ts=4 sw=4 sts noet mouse=a fdm=indent:
|
|
||||||
|
|
||||||
BYPASS="n"
|
|
||||||
DEBUG="n"
|
|
||||||
BUILDONLY="n"
|
|
||||||
|
|
||||||
SCRIPT_NAME=$(basename "$0")
|
|
||||||
VERSION=$(cat ./msspec/version.py|cut -d\" -f2)
|
|
||||||
DATE=$(date +%Y%m%d_%H%M%S)
|
|
||||||
LOGFILE="${HOME}/msspec_install_${DATE}.log"
|
|
||||||
GETOUTFILE=$(mktemp)
|
|
||||||
|
|
||||||
USE_MKL=0
|
|
||||||
LINKER_FLAGS=""
|
|
||||||
COMP=gfortran
|
|
||||||
COMP_OPTS="-O2 -ffast-math -fno-automatic"
|
|
||||||
DEBUG_MODE=0
|
|
||||||
|
|
||||||
|
|
||||||
trap "abort_install" INT
|
|
||||||
trap "error_exit" HUP QUIT ILL ABRT
|
|
||||||
|
|
||||||
init_install () {
|
|
||||||
printf "Installation started on %s\n" "$(date)" > "${LOGFILE}"
|
|
||||||
printf "0" > "${GETOUTFILE}"
|
|
||||||
|
|
||||||
if [ "$BYPASS" = "n" ]; then
|
|
||||||
printf ""
|
|
||||||
printf "This program will install the msspec python package on your system.\n"
|
|
||||||
printf "It is highly recommended to run this installation process within a\n"
|
|
||||||
printf "Python virtual environment. If you want to create and/or activate one,\n"
|
|
||||||
printf "you can answer \"n\" now and restart the setup program later.\n"
|
|
||||||
|
|
||||||
read_yes_no "Do you wish to continue" "y"
|
|
||||||
case "${ANSWER}" in
|
|
||||||
y) ;;
|
|
||||||
n) abort_install ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
abort_install () {
|
|
||||||
log_message "Installation aborted by the user"
|
|
||||||
error_exit
|
|
||||||
}
|
|
||||||
|
|
||||||
log_message () {
|
|
||||||
printf "$1\n" >> ${LOGFILE}
|
|
||||||
}
|
|
||||||
|
|
||||||
log_message2 () {
|
|
||||||
# echo to screen and to file
|
|
||||||
printf "$1\n"
|
|
||||||
log_message "$1\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup () {
|
|
||||||
rm -rf "${GETOUTFILE}"
|
|
||||||
}
|
|
||||||
|
|
||||||
error_exit () {
|
|
||||||
# An error occured
|
|
||||||
printf "\n"
|
|
||||||
printf " /!\ An error occured during the installation process.\n"
|
|
||||||
printf " Please see the %s file in your HOME folder\n" "$(basename "${LOGFILE}")"
|
|
||||||
printf " for more informations.\n"
|
|
||||||
printf " Below is an excerpt of the last 10 lines:\n"
|
|
||||||
printf "\n"
|
|
||||||
echo ">>> ..."
|
|
||||||
tail "${LOGFILE}" | while read line
|
|
||||||
do
|
|
||||||
echo ">>> $line"
|
|
||||||
done
|
|
||||||
|
|
||||||
# uninstall if needed
|
|
||||||
pip uninstall -y msspec
|
|
||||||
|
|
||||||
cleanup && exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
read_yes_no () {
|
|
||||||
DEFAULT="$2"
|
|
||||||
PROMPT="$1 (y/n) [${DEFAULT}]? "
|
|
||||||
|
|
||||||
ANSWER=""
|
|
||||||
INPUT=""
|
|
||||||
|
|
||||||
VALID=1
|
|
||||||
while test $VALID -ne 0; do
|
|
||||||
printf "%s" "${PROMPT}"
|
|
||||||
if [ x"$BYPASS" = xn ]; then
|
|
||||||
read -r "INPUT"
|
|
||||||
else
|
|
||||||
printf "\n"
|
|
||||||
fi
|
|
||||||
ANSWER="${INPUT:-${DEFAULT}}"
|
|
||||||
case "${ANSWER}" in
|
|
||||||
y|n) VALID=0 ;;
|
|
||||||
*) printf "Invalid choice, please answer \"y\" or \"n\".\n"; VALID=1 ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
log_message "QUESTION: $PROMPT"
|
|
||||||
log_message "ANSWER : $ANSWER"
|
|
||||||
}
|
|
||||||
|
|
||||||
wrap () {
|
|
||||||
log_message "================================================================================"
|
|
||||||
log_message "$2"
|
|
||||||
log_message "================================================================================"
|
|
||||||
log_message "$1"
|
|
||||||
if [ "$DEBUG" = y ]; then
|
|
||||||
printf "%s...\n" "$2"
|
|
||||||
(eval "$1" || echo $? >"${GETOUTFILE}") | tee -a "${LOGFILE}"
|
|
||||||
rc=$(cat $GETOUTFILE)
|
|
||||||
if [ $rc != 0 ]; then
|
|
||||||
error_exit
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
eval "($1) 2>>${LOGFILE} 1>>${LOGFILE}" || echo $? >${GETOUTFILE} &
|
|
||||||
patience "$2"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
success_message () {
|
|
||||||
log_message "========================================================"
|
|
||||||
log_message "MsSpec was successfully installed."
|
|
||||||
log_message "========================================================"
|
|
||||||
}
|
|
||||||
|
|
||||||
patience () {
|
|
||||||
MSG="$1"
|
|
||||||
PID=$!
|
|
||||||
i=0
|
|
||||||
printf "%s" "$MSG... "
|
|
||||||
while ps -p $PID > /dev/null
|
|
||||||
do
|
|
||||||
sleep 0.1
|
|
||||||
case $i in
|
|
||||||
0) printf "\b\b- " ;;
|
|
||||||
1) printf "\b\b\\ " ;;
|
|
||||||
2) printf "\b\b| " ;;
|
|
||||||
3) printf "\b\b/ "; i=-1 ;;
|
|
||||||
esac
|
|
||||||
i=$(( i+1 ))
|
|
||||||
done
|
|
||||||
if test "$(cat "${GETOUTFILE}")" -ne 0; then
|
|
||||||
printf "\b\b Aborted!"
|
|
||||||
error_exit
|
|
||||||
fi
|
|
||||||
printf "\b\b Done.\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
show_help () {
|
|
||||||
echo "Usage: $SCRIPT_NAME [OPTIONS]"
|
|
||||||
echo "List of possible options:"
|
|
||||||
echo " -y Accept all default choices."
|
|
||||||
echo " -d Debug mode."
|
|
||||||
echo " -h Show this message."
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
check_dependencies () {
|
|
||||||
# we need make
|
|
||||||
log_message "Checking if make is installed..."
|
|
||||||
command -V make || return 1
|
|
||||||
log_message "Ok\n"
|
|
||||||
|
|
||||||
# we need gfortran
|
|
||||||
gcc_ver_min=6
|
|
||||||
log_message "Checking if gfortran >= $gcc_ver_min is installed..."
|
|
||||||
command -V gfortran || return 1
|
|
||||||
gcc_ver=$(gcc -dumpversion|cut -d. -f1)
|
|
||||||
echo "You have gfortran version $gcc_ver installed"
|
|
||||||
test "$gcc_ver" -ge "$gcc_ver_min" || return 1
|
|
||||||
log_message "Ok\n"
|
|
||||||
|
|
||||||
# we need libcairo and dev files
|
|
||||||
log_message "Checking if libcairo is installed..."
|
|
||||||
pkg-config --exists cairo || return 1
|
|
||||||
log_message "Ok\n"
|
|
||||||
|
|
||||||
# we need Python 3
|
|
||||||
py_ver_major_min=3
|
|
||||||
py_ver_minor_min=0
|
|
||||||
log_message "Checking if Python >= ${py_ver_major_min}.${py_ver_minor_min}..."
|
|
||||||
command -V python || return 1
|
|
||||||
py_ver=$(python --version | cut -d" " -f2)
|
|
||||||
echo "You have Python version $py_ver installed"
|
|
||||||
py_ver_major=$(echo $py_ver|cut -d. -f1)
|
|
||||||
py_ver_minor=$(echo $py_ver|cut -d. -f2)
|
|
||||||
test "$py_ver_major" -ge "$py_ver_major_min" || return 1
|
|
||||||
test "$py_ver_minor" -ge "$py_ver_minor_min" || return 1
|
|
||||||
log_message "Ok\n"
|
|
||||||
|
|
||||||
# we need wxPython.
|
|
||||||
log_message "Checking if wxPython is installed..."
|
|
||||||
python -c "import wx"
|
|
||||||
if test "$?" -ne 0; then
|
|
||||||
log_message "You need wxPython to run MsSpec.\n"
|
|
||||||
log_message "Please look at informations at https://wxpython.org/pages/downloads/.\n"
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
log_message "Ok\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# we need pip
|
|
||||||
log_message "Checking if pip is installed..."
|
|
||||||
command -V pip || return 1
|
|
||||||
log_message "Ok\n"
|
|
||||||
|
|
||||||
# we need virtualenv
|
|
||||||
#log_message "Checking if virtualenv is installed..."
|
|
||||||
#command -V virtualenv || return 1
|
|
||||||
#log_message "Ok\n"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
local_install () {
|
|
||||||
# Initialize the install process
|
|
||||||
init_install
|
|
||||||
|
|
||||||
# check dependencies
|
|
||||||
wrap "check_dependencies" "Checking dependencies"
|
|
||||||
|
|
||||||
# Do we have Lapack.
|
|
||||||
log_message "Checking if lapack is installed..."
|
|
||||||
pkg-config --exists lapack
|
|
||||||
if test "$?" -ne 0; then
|
|
||||||
HAS_LAPACK="n"
|
|
||||||
log_message "No, will use included routines\n"
|
|
||||||
else
|
|
||||||
HAS_LAPACK="y"
|
|
||||||
log_message "Ok\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"${HAS_LAPACK}" = xy ]; then
|
|
||||||
read_yes_no "You have Lapack. Do you wish to link with installed lapack" "y"
|
|
||||||
if [ x"${ANSWER}" = xy ]; then
|
|
||||||
USE_MKL=1
|
|
||||||
LINKER_FLAGS=`pkg-config --libs lapack`
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ask for expert options
|
|
||||||
read_yes_no "Do you wish to edit compilation options" "n"
|
|
||||||
if [ x"${ANSWER}" = xy ]; then
|
|
||||||
read -ep "FORTRAN COMPILER...................> " -i "${COMP}" COMP
|
|
||||||
read -ep "COMPILER OPTIONS...................> " -i "${COMP_OPTS}" COMP_OPTS
|
|
||||||
read -ep "USE EXTERNAL LAPACK (0:no, 1:yes)..> " -i "${USE_MKL}" USE_MKL
|
|
||||||
read -ep "LINKER FLAGS.......................> " -i "${LINKER_FLAGS}" LINKER_FLAGS
|
|
||||||
read -ep "INCLUDE DEBUG SYMBOLS (0:no, 1:yes)> " -i "${DEBUG_MODE}" DEBUG_MODE
|
|
||||||
fi
|
|
||||||
|
|
||||||
ALL_OPTS="VERBOSE=1 USE_MKL=${USE_MKL} LINKER_FLAGS=\"${LINKER_FLAGS}\" COMP=\"${COMP}\" COMP_OPTS=\"${COMP_OPTS}\" DEBUG=\"${DEBUG_MODE}\""
|
|
||||||
|
|
||||||
# build the Fortran code
|
|
||||||
wrap "make pybinding ${ALL_OPTS}" "Building Phagen and Spec Python dynamic library"
|
|
||||||
|
|
||||||
if [ x"${BUILDONLY}" = xy ]; then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# install Python dependencies
|
|
||||||
wrap "make install_deps ${ALL_OPTS}" "Installing Python dependencies"
|
|
||||||
|
|
||||||
# build the source distribution
|
|
||||||
wrap "make sdist ${ALL_OPTS}" "Building msspec python package"
|
|
||||||
|
|
||||||
# install the package
|
|
||||||
wrap "make install ${ALL_OPTS}" "Installing the msspec package"
|
|
||||||
|
|
||||||
# Run unit tests ?
|
|
||||||
read_yes_no "Do you wish to run unit tests" "y"
|
|
||||||
if [ x"${ANSWER}" = xy ]; then
|
|
||||||
wrap "make tests ${ALL_OPTS}" "Runing test suite"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# installation was a succes so ask if we keep the log file
|
|
||||||
read_yes_no "Do you wish to keep the log file (${LOGFILE})" "n"
|
|
||||||
if [ x"${ANSWER}" = xn ]; then
|
|
||||||
rm -f "${LOGFILE}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# self-explanatory
|
|
||||||
success_message
|
|
||||||
}
|
|
||||||
|
|
||||||
while getopts "p:byd" option
|
|
||||||
do
|
|
||||||
case $option in
|
|
||||||
y) export BYPASS="y"
|
|
||||||
;;
|
|
||||||
d) export DEBUG="y"
|
|
||||||
;;
|
|
||||||
b) export BUILDONLY="y"
|
|
||||||
;;
|
|
||||||
h) show_help
|
|
||||||
;;
|
|
||||||
*) show_help
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
local_install
|
|
|
@ -60,6 +60,8 @@ import wx.grid
|
||||||
|
|
||||||
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
|
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
|
||||||
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
|
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
|
||||||
|
#from matplotlib.backends.backend_wxcairo import FigureCanvasWxCairo as FigureCanvas
|
||||||
|
#from matplotlib.backends.backend_wxcairo import NavigationToolbar2WxCairo
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
|
|
||||||
from terminaltables import AsciiTable
|
from terminaltables import AsciiTable
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
COMP=gfortran
|
|
||||||
F2PY:=f2py3
|
|
||||||
|
|
||||||
COMP_OPTS:= -O2 -ffast-math
|
|
||||||
F2PY_OPTS:=
|
|
||||||
|
|
||||||
DEBUG:=0
|
|
||||||
|
|
||||||
objects_src := phagen_scf_2.1_dp.f
|
|
||||||
objects := $(patsubst %.f,%.o, $(objects_src))
|
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
|
||||||
COMP_OPTS:=$(COMP_OPTS) -g -Wall -Wextra -Warray-temporaries -Wconversion -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=zero,overflow,underflow -finit-real=nan
|
|
||||||
F2PY_OPTS:=$(F2PY_OPTS) --debug-capi --debug
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
|
|
||||||
pybinding: libphagen.target
|
|
||||||
|
|
||||||
libphagen.target: $(objects) main.f
|
|
||||||
@echo "building Python binding..."
|
|
||||||
@$(F2PY) -I. $(objects) $(F2PY_OPTS)-c -m libphagen main.f
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
$(objects): $(objects_src)
|
|
||||||
@echo "compiling subroutines and functions for phagen..."
|
|
||||||
@$(COMP) $(COMP_OPTS) -fPIC -c $^
|
|
||||||
|
|
||||||
clean:
|
|
||||||
@echo "cleaning..."
|
|
||||||
@rm -rf *.o *.mod
|
|
||||||
@rm -rf $(objects)
|
|
||||||
@rm -f libphagen.target
|
|
|
@ -1,17 +1,10 @@
|
||||||
try:
|
Import('env')
|
||||||
Import('env')
|
import os
|
||||||
except:
|
|
||||||
local_build = True
|
|
||||||
Export('local_build')
|
|
||||||
SConscript(['../../../SConstruct'])
|
|
||||||
finally:
|
|
||||||
Import('env')
|
|
||||||
|
|
||||||
|
|
||||||
objects_src= ['phagen_scf_2.1_dp.f']
|
objects_src= ['phagen_scf_2.1_dp.f']
|
||||||
objects = env.Object(objects_src)
|
objects = env.Object(objects_src)
|
||||||
|
|
||||||
module = env.F2PY('libphagen', ['main.f'] + objects)
|
module = env.F2py('libphagen', ['main.f'] + objects, F2PYCOMSTR=">>")
|
||||||
Requires(module, objects)
|
env.InstallModule(module)
|
||||||
|
|
||||||
env.Alias('phagen', module)
|
env.Alias('phagen', module)
|
||||||
|
|
|
@ -8140,7 +8140,13 @@ c.....this subroutine calculates the radial matrix elements
|
||||||
c.....necessary for eels cross-section
|
c.....necessary for eels cross-section
|
||||||
c.....using a linear-log mesh
|
c.....using a linear-log mesh
|
||||||
c
|
c
|
||||||
common/mtxele/ nstart,nlast
|
CST ==> Replaced the line below
|
||||||
|
CST common/mtxele/ nstart,nlast
|
||||||
|
common/mtxele/ nstart,nlast,dmx(2),dmx1(2),qmx(3),qmx1(3),
|
||||||
|
$ dxdir,dxexc,nfis,nfis1,nfis2
|
||||||
|
real*8 nfis,nfis2,nfis1
|
||||||
|
complex*16 dmx,dmx1,qmx,qmx1,dxdir,dxexc
|
||||||
|
CST <==
|
||||||
c
|
c
|
||||||
common/mtxelex/ dmxx(2),dmxx1(2),dmxxa(2),dmxxa1(2),
|
common/mtxelex/ dmxx(2),dmxx1(2),dmxxa(2),dmxxa1(2),
|
||||||
& qmxx(3),qmxx1(3),qmxxa(3),qmxxa1(3),
|
& qmxx(3),qmxx1(3),qmxxa(3),qmxxa1(3),
|
||||||
|
@ -17000,7 +17006,13 @@ c.....(i=1,2) for lfin=l0i-1 (i=1) and lfin=l0i+1 (i=2) both for
|
||||||
c.....the regular (dmxx) and irregular solution (dmxx1) using a
|
c.....the regular (dmxx) and irregular solution (dmxx1) using a
|
||||||
c.....linear-log mesh
|
c.....linear-log mesh
|
||||||
c
|
c
|
||||||
common/mtxele/ nstart,nlast
|
CST ==> Replaced the line below
|
||||||
|
CST common/mtxele/ nstart,nlast
|
||||||
|
common/mtxele/ nstart,nlast,dmx(2),dmx1(2),qmx(3),qmx1(3),
|
||||||
|
$ dxdir,dxexc,nfis,nfis1,nfis2
|
||||||
|
real*8 nfis,nfis2,nfis1
|
||||||
|
complex*16 dmx,dmx1,qmx,qmx1,dxdir,dxexc
|
||||||
|
CST <==
|
||||||
c
|
c
|
||||||
common/mtxelex/ dmxx(2),dmxx1(2),dmxxa(2),dmxxa1(2),
|
common/mtxelex/ dmxx(2),dmxx1(2),dmxxa(2),dmxxa1(2),
|
||||||
& qmxx(3),qmxx1(3),qmxxa(3),qmxxa1(3),
|
& qmxx(3),qmxx1(3),qmxxa(3),qmxxa1(3),
|
||||||
|
@ -20199,7 +20211,8 @@ C MARK 12 RELEASE. NAG COPYRIGHT 1986.
|
||||||
C MARK 15 REVISED. IER-915 (APR 1991).
|
C MARK 15 REVISED. IER-915 (APR 1991).
|
||||||
C .. Scalar Arguments ..
|
C .. Scalar Arguments ..
|
||||||
INTEGER INFO
|
INTEGER INFO
|
||||||
CHARACTER*13 SRNAME
|
CHARACTER(*) SRNAME
|
||||||
|
CST CHARACTER*13 SRNAME
|
||||||
C ..
|
C ..
|
||||||
C
|
C
|
||||||
C Purpose
|
C Purpose
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
COMP:=gfortran
|
|
||||||
F2PY:=f2py3
|
|
||||||
|
|
||||||
COMP_OPTS:= -O2 -ffast-math -fno-automatic
|
|
||||||
LINKER_FLAGS:=
|
|
||||||
F2PY_OPTS:=
|
|
||||||
|
|
||||||
DEBUG:=0
|
|
||||||
USE_MKL:=0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
includes := -I./memalloc/ -I./cluster_gen/ -I./common_sub -I./renormalization
|
|
||||||
includes += -I./phd_se_noso_nosp_nosym
|
|
||||||
includes += -I./eig/common -I./eig/mi -I./eig/pw
|
|
||||||
|
|
||||||
memalloc_src:=memalloc/dim_mod.f memalloc/modules.f memalloc/allocation.f
|
|
||||||
cluster_gen_src:=$(wildcard cluster_gen/*.f)
|
|
||||||
common_sub_src:=$(wildcard common_sub/*.f)
|
|
||||||
renormalization_src:=$(wildcard renormalization/*.f)
|
|
||||||
|
|
||||||
phd_se_noso_nosp_nosym_src:=$(filter-out phd_se_noso_nosp_nosym/main.f, $(wildcard phd_se_noso_nosp_nosym/*.f))
|
|
||||||
phd_mi_noso_nosp_nosym_src:=$(filter-out phd_mi_noso_nosp_nosym/main.f, $(wildcard phd_mi_noso_nosp_nosym/*.f))
|
|
||||||
|
|
||||||
eig_common_src:=$(wildcard eig/common/*.f)
|
|
||||||
eig_mi_src:=$(filter-out eig/mi/main.f, $(wildcard eig/mi/*.f))
|
|
||||||
eig_pw_src:=$(filter-out eig/pw/main.f, $(wildcard eig/pw/*.f))
|
|
||||||
|
|
||||||
ifeq ($(USE_MKL), 1)
|
|
||||||
eig_common_src:=$(filter-out $(wildcard eig/common/lapack*.f), $(eig_common_src))
|
|
||||||
phd_mi_noso_nosp_nosym_src:=$(filter-out $(wildcard phd_mi_noso_nosp_nosym/lapack*.f), $(phd_mi_noso_nosp_nosym_src))
|
|
||||||
LINKER_FLAGS:=$(shell pkg-config --libs lapack)
|
|
||||||
# MKL:=-L$(MKLROOT) -lmkl_core -lmkl_intel_lp64 -lmkl_sequential
|
|
||||||
endif
|
|
||||||
|
|
||||||
objects_src := $(memalloc_src) $(cluster_gen_src) $(common_sub_src)
|
|
||||||
objects_src += $(renormalization_src) $(phd_se_noso_nosp_nosym_src)
|
|
||||||
objects_src += $(eig_common_src) $(eig_mi_src) $(eig_pw_src)
|
|
||||||
objects_src += $(phd_mi_noso_nosp_nosym_src)
|
|
||||||
|
|
||||||
memalloc_obj:=$(patsubst %.f,%.o, $(memalloc_src))
|
|
||||||
cluster_gen_obj:=$(patsubst %.f,%.o, $(cluster_gen_src))
|
|
||||||
common_sub_obj:=$(patsubst %.f,%.o, $(common_sub_src))
|
|
||||||
renormalization_obj:=$(patsubst %.f,%.o, $(renormalization_src))
|
|
||||||
phd_se_noso_nosp_nosym_obj:=$(patsubst %.f,%.o, $(phd_se_noso_nosp_nosym_src))
|
|
||||||
phd_mi_noso_nosp_nosym_obj:=$(patsubst %.f,%.o, $(phd_mi_noso_nosp_nosym_src))
|
|
||||||
eig_common_obj:=$(patsubst %.f,%.o, $(eig_common_src))
|
|
||||||
eig_mi_obj:=$(patsubst %.f,%.o, $(eig_mi_src))
|
|
||||||
eig_pw_obj:=$(patsubst %.f,%.o, $(eig_pw_src))
|
|
||||||
objects:=$(patsubst %.f,%.o, $(objects_src))
|
|
||||||
|
|
||||||
libs_targets := phd_se_noso_nosp_nosym.target phd_mi_noso_nosp_nosym.target eig_mi.target eig_pw.target
|
|
||||||
|
|
||||||
EXE=prog
|
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
|
||||||
COMP_OPTS:=$(COMP_OPTS) -g -Wall -Wextra -Warray-temporaries -Wconversion -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=zero,overflow,underflow -finit-real=nan
|
|
||||||
F2PY_OPTS:=$(F2PY_OPTS) --debug-capi --debug
|
|
||||||
endif
|
|
||||||
|
|
||||||
export COMP
|
|
||||||
export COMP_OPTS
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
|
|
||||||
|
|
||||||
pybinding: $(libs_targets)
|
|
||||||
|
|
||||||
phd_se_noso_nosp_nosym.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(phd_se_noso_nosp_nosym_obj)
|
|
||||||
@echo "building Python binding..."
|
|
||||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) phd_se_noso_nosp_nosym/main.f
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
phd_mi_noso_nosp_nosym.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(phd_mi_noso_nosp_nosym_obj)
|
|
||||||
@echo "building Python binding..."
|
|
||||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) phd_mi_noso_nosp_nosym/main.f $(LINKER_FLAGS)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
eig_mi.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_mi_obj)
|
|
||||||
@echo "building Python binding..."
|
|
||||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) eig/mi/main.f $(LINKER_FLAGS)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
eig_pw.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_pw_obj)
|
|
||||||
@echo "building Python binding..."
|
|
||||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) eig/pw/main.f $(LINKER_FLAGS)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
%.o: %.f
|
|
||||||
@echo "compiling $@..."
|
|
||||||
@$(COMP) $(COMP_OPTS) -I./memalloc/ -fPIC -o $@ -c $^
|
|
||||||
|
|
||||||
clean:
|
|
||||||
@echo "cleaning..."
|
|
||||||
@rm -rf *.o *.mod
|
|
||||||
@rm -rf $(objects)
|
|
||||||
@rm -rf $(libs_targets)
|
|
|
@ -1,22 +1,11 @@
|
||||||
# imports
|
Import('env')
|
||||||
try:
|
import os
|
||||||
Import('env', 'conf')
|
|
||||||
except:
|
|
||||||
local_build = True
|
|
||||||
Export('local_build')
|
|
||||||
SConscript(['../../../SConstruct'])
|
|
||||||
finally:
|
|
||||||
Import('env', 'conf')
|
|
||||||
|
|
||||||
# Configuration:
|
# Configure the environment
|
||||||
env2 = env.Clone()
|
env_spec = env.Clone()
|
||||||
if conf.CheckPKG('lapack'):
|
cwd = Dir('.').get_abspath()
|
||||||
env2.ParseConfig("pkg-config lapack --libs")
|
env_spec.Append(FORTRANFLAGS=['-I' + cwd,'-J' + cwd])
|
||||||
conf.Finish()
|
env_spec.Append(F2PY_OPTS=['-I' + cwd])
|
||||||
|
|
||||||
dir = Dir('.').get_abspath()
|
|
||||||
env2.Append(FORTRANFLAGS=['-I' + dir,'-J' + dir])
|
|
||||||
env2.Append(F2PY_OPTS=['-I' + dir])
|
|
||||||
|
|
||||||
# define sources
|
# define sources
|
||||||
dim_mod = ['memalloc/dim_mod.f']
|
dim_mod = ['memalloc/dim_mod.f']
|
||||||
|
@ -24,53 +13,53 @@ memalloc = ['memalloc/modules.f', 'memalloc/allocation.f']
|
||||||
cluster_gen = Glob('cluster_gen/*.f')
|
cluster_gen = Glob('cluster_gen/*.f')
|
||||||
common_sub = Glob('common_sub/*.f')
|
common_sub = Glob('common_sub/*.f')
|
||||||
renormalization = Glob('renormalization/*.f')
|
renormalization = Glob('renormalization/*.f')
|
||||||
phd_se_noso_nosp_nosym = env2.FilteredGlob('phd_se_noso_nosp_nosym/*.f', omit=['main.f'])
|
phd_se_noso_nosp_nosym = env_spec.FilteredGlob('phd_se_noso_nosp_nosym/*.f', omit=['main.f'])
|
||||||
phd_mi_noso_nosp_nosym = env2.FilteredGlob('phd_mi_noso_nosp_nosym/*.f', omit=['main.f'])
|
phd_mi_noso_nosp_nosym = env_spec.FilteredGlob('phd_mi_noso_nosp_nosym/*.f', omit=['main.f'])
|
||||||
eig_common = Glob('eig/common/*.f')
|
eig_common = Glob('eig/common/*.f')
|
||||||
eig_mi = env2.FilteredGlob('eig/mi/*.f', omit=['main.f'])
|
eig_mi = env_spec.FilteredGlob('eig/mi/*.f', omit=['main.f'])
|
||||||
eig_pw = env2.FilteredGlob('eig/pw/*.f', omit=['main.f'])
|
eig_pw = env_spec.FilteredGlob('eig/pw/*.f', omit=['main.f'])
|
||||||
|
|
||||||
|
conf = Configure(env_spec, log_file='./config.log')
|
||||||
if 'lapack' in env2['LIBS']:
|
if conf.CheckLib('lapack'):
|
||||||
env2.Append(F2PY_OPTS = "-llapack")
|
env_spec.Append(F2PY_OPTS = "-llapack")
|
||||||
eig_mi = [f for f in eig_mi if str(f).find('lapack') == -1]
|
eig_mi = [f for f in eig_mi if str(f).find('lapack') == -1]
|
||||||
phd_mi_noso_nosp_nosym = [f for f in phd_mi_noso_nosp_nosym if str(f).find('lapack') == -1]
|
phd_mi_noso_nosp_nosym = [f for f in phd_mi_noso_nosp_nosym if str(f).find('lapack') == -1]
|
||||||
|
env_spec = conf.Finish()
|
||||||
sources = dim_mod + memalloc + cluster_gen + common_sub + renormalization + phd_se_noso_nosp_nosym
|
env_spec.Append(FORTRANFLAGS='-fno-automatic')
|
||||||
sources += phd_mi_noso_nosp_nosym + eig_common + eig_pw + eig_mi
|
|
||||||
|
|
||||||
# define objects
|
# define objects
|
||||||
dim_mod_obj = env2.Object(dim_mod)
|
dim_mod_obj = env_spec.Object(dim_mod)
|
||||||
memalloc_obj = env2.Object(memalloc)
|
memalloc_obj = env_spec.Object(memalloc)
|
||||||
cluster_gen_obj = env2.Object(cluster_gen)
|
cluster_gen_obj = env_spec.Object(cluster_gen)
|
||||||
common_sub_obj = env2.Object(common_sub)
|
common_sub_obj = env_spec.Object(common_sub)
|
||||||
renormalization_obj = env2.Object(renormalization)
|
renormalization_obj = env_spec.Object(renormalization)
|
||||||
phd_se_noso_nosp_nosym_obj = env2.Object(phd_se_noso_nosp_nosym)
|
phd_se_noso_nosp_nosym_obj = env_spec.Object(phd_se_noso_nosp_nosym)
|
||||||
phd_mi_noso_nosp_nosym_obj = env2.Object(phd_mi_noso_nosp_nosym)
|
phd_mi_noso_nosp_nosym_obj = env_spec.Object(phd_mi_noso_nosp_nosym)
|
||||||
eig_common_obj = env2.Object(eig_common)
|
eig_common_obj = env_spec.Object(eig_common)
|
||||||
eig_pw_obj = env2.Object(eig_pw)
|
eig_pw_obj = env_spec.Object(eig_pw)
|
||||||
eig_mi_obj = env2.Object(eig_mi)
|
eig_mi_obj = env_spec.Object(eig_mi)
|
||||||
|
|
||||||
Requires(memalloc_obj, dim_mod_obj)
|
Requires(memalloc_obj, dim_mod_obj)
|
||||||
|
|
||||||
# define Python extensions
|
# define Python extensions
|
||||||
common_deps = dim_mod_obj + memalloc_obj + cluster_gen_obj + common_sub_obj
|
common_deps = dim_mod_obj + memalloc_obj + cluster_gen_obj + common_sub_obj
|
||||||
|
|
||||||
deps = common_deps + renormalization_obj + phd_se_noso_nosp_nosym_obj
|
deps = common_deps + renormalization_obj + phd_se_noso_nosp_nosym_obj
|
||||||
phd_se_mod = env2.F2PY('_phd_se_noso_nosp_nosym', ['phd_se_noso_nosp_nosym/main.f'] + deps)
|
phd_se_mod = env_spec.F2py('_phd_se_noso_nosp_nosym', ['phd_se_noso_nosp_nosym/main.f'] + deps)
|
||||||
Requires(phd_se_mod, deps)
|
env_spec.InstallModule(phd_se_mod)
|
||||||
env2.Alias('phd_se', phd_se_mod)
|
|
||||||
|
|
||||||
deps = common_deps + renormalization_obj + phd_mi_noso_nosp_nosym_obj
|
deps = common_deps + renormalization_obj + phd_mi_noso_nosp_nosym_obj
|
||||||
phd_mi_mod = env2.F2PY('_phd_mi_noso_nosp_nosym', ['phd_mi_noso_nosp_nosym/main.f'] + deps)
|
phd_mi_mod = env_spec.F2py('_phd_mi_noso_nosp_nosym', ['phd_mi_noso_nosp_nosym/main.f'] + deps)
|
||||||
Requires(phd_mi_mod, deps)
|
env_spec.InstallModule(phd_mi_mod)
|
||||||
env2.Alias('phd_mi', phd_mi_mod)
|
|
||||||
|
|
||||||
deps = common_deps + renormalization_obj + eig_common_obj + eig_mi_obj
|
deps = common_deps + renormalization_obj + eig_common_obj + eig_mi_obj
|
||||||
eig_mi_mod = env2.F2PY('_eig_mi', ['eig/mi/main.f'] + deps)
|
eig_mi_mod = env_spec.F2py('_eig_mi', ['eig/mi/main.f'] + deps)
|
||||||
Requires(eig_mi_mod, deps)
|
env_spec.InstallModule(eig_mi_mod)
|
||||||
env2.Alias('eig_mi', eig_mi_mod)
|
|
||||||
|
|
||||||
deps = common_deps + renormalization_obj + eig_common_obj + eig_pw_obj
|
deps = common_deps + renormalization_obj + eig_common_obj + eig_pw_obj
|
||||||
eig_pw_mod = env2.F2PY('_eig_pw', ['eig/pw/main.f'] + deps)
|
eig_pw_mod = env_spec.F2py('_eig_pw', ['eig/pw/main.f'] + deps)
|
||||||
Requires(eig_pw_mod, deps)
|
env_spec.InstallModule(eig_pw_mod)
|
||||||
env2.Alias('eig_pw', eig_pw_mod)
|
|
||||||
|
# Alias
|
||||||
|
env_spec.Alias('spec', [phd_se_mod, phd_mi_mod, eig_pw_mod, eig_mi_mod])
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MODULE DIM_MOD
|
MODULE DIM_MOD
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
INTEGER NATP_M, NATCLU_M, NAT_EQ_M, N_CL_L_M
|
INTEGER NATP_M, NATCLU_M, NAT_EQ_M, N_CL_L_M
|
||||||
|
|
|
@ -7,8 +7,7 @@ import os
|
||||||
|
|
||||||
# find the version number
|
# find the version number
|
||||||
# 1- Try to read it from the git info
|
# 1- Try to read it from the git info
|
||||||
# 2- If it fails, try to read it from the VERSION file
|
# 2- If it fails, try to read it from the distribution file
|
||||||
# 3- If it fails, try to read it from the distribution file
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
v = get_version(root='../../', relative_to=__file__, version_scheme="post-release")
|
v = get_version(root='../../', relative_to=__file__, version_scheme="post-release")
|
||||||
|
@ -17,14 +16,9 @@ try:
|
||||||
__version__ = v.base_version
|
__version__ = v.base_version
|
||||||
else:
|
else:
|
||||||
__version__ = v.public
|
__version__ = v.public
|
||||||
except (LookupError, ImportError):
|
except Exception as err:
|
||||||
try:
|
try:
|
||||||
f = os.path.join(os.path.dirname(__file__), "../VERSION")
|
__version__ = get_distribution(__name__.strip('.version')).version
|
||||||
with open(f, "r") as fd:
|
except Exception as err:
|
||||||
__version__ = fd.read().strip('\n ')
|
print("Unable to get the version number!")
|
||||||
except:
|
__version__ = "9.9.9"
|
||||||
try:
|
|
||||||
__version__ = get_distribution(__name__.strip('.version')).version
|
|
||||||
except DistributionNotFound:
|
|
||||||
print("Unable to get the version number!")
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
numpy
|
numpy
|
||||||
|
matplotlib==2.1.1
|
||||||
ase
|
ase
|
||||||
h5py
|
h5py
|
||||||
lxml
|
lxml
|
||||||
pint
|
pint
|
||||||
terminaltables
|
terminaltables
|
||||||
pycairo
|
pycairo
|
||||||
coverage
|
|
||||||
sphinx
|
|
||||||
setuptools_scm
|
setuptools_scm
|
||||||
wxPython
|
wxPython
|
||||||
|
|
57
src/setup.py
57
src/setup.py
|
@ -13,72 +13,23 @@ import subprocess
|
||||||
import traceback
|
import traceback
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import glob
|
||||||
sys.path.insert(0, "msspec")
|
sys.path.insert(0, "msspec")
|
||||||
|
|
||||||
|
|
||||||
from version import __version__
|
from version import __version__
|
||||||
|
|
||||||
|
with open('setup_requirements.txt', 'r') as fd:
|
||||||
|
SETUP_REQUIREMENTS = fd.read().strip().split('\n')
|
||||||
|
|
||||||
SETUP_REQUIRES = ['scons', 'setuptools_scm']
|
|
||||||
with open('requirements.txt', 'r') as fd:
|
with open('requirements.txt', 'r') as fd:
|
||||||
REQUIREMENTS = fd.read().strip().split('\n')
|
REQUIREMENTS = fd.read().strip().split('\n')
|
||||||
|
|
||||||
subprocess.call(["pip", "install"] + SETUP_REQUIRES)
|
|
||||||
|
|
||||||
|
|
||||||
class BuildExtCmd(_build_ext):
|
|
||||||
def run(self):
|
|
||||||
src_dir = "."
|
|
||||||
subprocess.call(['scons'])
|
|
||||||
for ext in self.extensions:
|
|
||||||
fullname = self.get_ext_fullname(ext.name)
|
|
||||||
filename = self.get_ext_filename(fullname)
|
|
||||||
print("building ", filename)
|
|
||||||
|
|
||||||
src_filename = filename
|
|
||||||
dest_filename = os.path.join(self.build_lib, filename)
|
|
||||||
|
|
||||||
os.makedirs(os.path.dirname(dest_filename), exist_ok=True)
|
|
||||||
copy_file(src_filename, dest_filename, verbose=self.verbose,
|
|
||||||
dry_run=self.dry_run)
|
|
||||||
|
|
||||||
|
|
||||||
class BuildCmd(_build):
|
|
||||||
def run(self):
|
|
||||||
print("build_lib ", self.build_lib)
|
|
||||||
self.run_command("build_ext")
|
|
||||||
_build.run(self)
|
|
||||||
|
|
||||||
class InstallCmd(_install):
|
|
||||||
def run(self):
|
|
||||||
self.run_command("build")
|
|
||||||
_install.run(self)
|
|
||||||
|
|
||||||
class CleanCmd(_clean):
|
|
||||||
def run(self):
|
|
||||||
subprocess.call(['scons', '-c'])
|
|
||||||
_clean.run(self)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
module_phagen = Extension('msspec.phagen.fortran.libphagen',['msspec/phagen/fortran/main.f'])
|
|
||||||
module_spec_phd_mi = Extension('msspec.spec.fortran._phd_mi_noso_nosp_nosym',['msspec/spec/fortran/phd_mi_noso_nosp_nosym/main.f'])
|
|
||||||
module_spec_phd_se = Extension('msspec.spec.fortran._phd_se_noso_nosp_nosym',['msspec/spec/fortran/phd_se_noso_nosp_nosym/main.f'])
|
|
||||||
module_eig_mi = Extension('msspec.spec.fortran._eig_mi',['msspec/spec/fortran/eig/mi/main.f'])
|
|
||||||
module_eig_pw = Extension('msspec.spec.fortran._eig_pw',['msspec/spec/fortran/eig/pw/main.f'])
|
|
||||||
|
|
||||||
setup(name='msspec',
|
setup(name='msspec',
|
||||||
version=__version__,
|
version=__version__,
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
ext_modules=[module_phagen, module_spec_phd_mi, module_spec_phd_se, module_eig_mi, module_eig_pw],
|
|
||||||
cmdclass={'build' : BuildCmd,
|
|
||||||
'build_ext': BuildExtCmd,
|
|
||||||
'clean' : CleanCmd,
|
|
||||||
'install' : InstallCmd,
|
|
||||||
},
|
|
||||||
packages=find_packages(include='msspec.*'),
|
packages=find_packages(include='msspec.*'),
|
||||||
setup_requires=SETUP_REQUIRES,
|
setup_requires=SETUP_REQUIREMENTS,
|
||||||
install_requires=REQUIREMENTS,
|
install_requires=REQUIREMENTS,
|
||||||
|
|
||||||
author='Didier Sébilleau, Sylvain Tricot',
|
author='Didier Sébilleau, Sylvain Tricot',
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
scons
|
||||||
|
setuptools_scm
|
||||||
|
numpy
|
||||||
|
sphinx
|
||||||
|
coverage
|
Loading…
Reference in New Issue