Also handle modules for Python 3

The way that this is implemented is a complete hack, but mpi
modules do not provide this information in another way. What
is worse, it will not be enough to add ${MPI_PYTHON3_SITEARCH},
because current scheme cannot support more than one version of
Python, because it modifies PYTHONPATH, which cannot be done
properly before Python version is known.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2015-08-17 19:22:06 -04:00
parent debf66a1e8
commit 0a13f127eb
2 changed files with 14 additions and 1 deletions

10
mpi.req
View File

@ -28,6 +28,9 @@ if [ ! -d "$buildroot" ]; then
exit 1 exit 1
fi fi
# Try to determine python3 version in the same way that %{python3_version} does
PYTHON3_VERSION="$(/usr/bin/python3 -c 'import sys; sys.stdout.write(sys.version[:3])')"
# Remaining arguments are passed to elfdeps # Remaining arguments are passed to elfdeps
shift shift
elfdepsargs="$@" elfdepsargs="$@"
@ -54,8 +57,15 @@ if [ -e /etc/profile.d/modules.sh ]; then
mpi_compiler_for_dir[${MPI_HOME}]=${MPI_COMPILER} mpi_compiler_for_dir[${MPI_HOME}]=${MPI_COMPILER}
mpi_compiler_for_dir[${MPI_FORTRAN_MOD_DIR}]=${MPI_COMPILER} mpi_compiler_for_dir[${MPI_FORTRAN_MOD_DIR}]=${MPI_COMPILER}
mpi_compiler_for_dir[${MPI_PYTHON_SITEARCH}]=${MPI_COMPILER} mpi_compiler_for_dir[${MPI_PYTHON_SITEARCH}]=${MPI_COMPILER}
if [ -n "${MPI_PYTHON_SITEARCH}" -a -n "${PYTHON3_VERSION}" ]; then
if [ -z "${MPI_PYTHON3_SITEARCH}" ]; then
MPI_PYTHON3_SITEARCH="${MPI_PYTHON_SITEARCH/2.7/${PYTHON3_VERSION}}"
fi
mpi_compiler_for_dir[${MPI_PYTHON3_SITEARCH}]=${MPI_COMPILER}
fi
mpi_lib_for_compiler[${MPI_COMPILER}]=${MPI_LIB} mpi_lib_for_compiler[${MPI_COMPILER}]=${MPI_LIB}
module unload $module module unload $module
unset MPI_PYTHON3_SITEARCH
done done
fi fi

View File

@ -1,6 +1,6 @@
Name: rpm-mpi-hooks Name: rpm-mpi-hooks
Version: 3 Version: 3
Release: 1%{?dist} Release: 2%{?dist}
Summary: RPM dependency generator hooks for MPI packages Summary: RPM dependency generator hooks for MPI packages
License: MIT License: MIT
@ -47,6 +47,9 @@ install -Dpm 0755 %{SOURCE3} %{buildroot}%{_rpmconfigdir}/mpi.req
%changelog %changelog
* Mon Aug 17 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3-2
- Also handle modules for Python 3
* Mon Aug 10 2015 Sandro Mani <manisandro@gmail.com> 3-1 * Mon Aug 10 2015 Sandro Mani <manisandro@gmail.com> 3-1
- Also handle binaries in $MPI_FORTRAN_MOD_DIR and $MPI_PYTHON_SITEARCH - Also handle binaries in $MPI_FORTRAN_MOD_DIR and $MPI_PYTHON_SITEARCH