diff --git a/mpi.req b/mpi.req index b5eb191..e790090 100755 --- a/mpi.req +++ b/mpi.req @@ -28,6 +28,9 @@ if [ ! -d "$buildroot" ]; then exit 1 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 shift 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_FORTRAN_MOD_DIR}]=${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} module unload $module + unset MPI_PYTHON3_SITEARCH done fi diff --git a/rpm-mpi-hooks.spec b/rpm-mpi-hooks.spec index 4713894..3401aac 100644 --- a/rpm-mpi-hooks.spec +++ b/rpm-mpi-hooks.spec @@ -1,6 +1,6 @@ Name: rpm-mpi-hooks Version: 3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM dependency generator hooks for MPI packages License: MIT @@ -47,6 +47,9 @@ install -Dpm 0755 %{SOURCE3} %{buildroot}%{_rpmconfigdir}/mpi.req %changelog +* Mon Aug 17 2015 Zbigniew Jędrzejewski-Szmek - 3-2 +- Also handle modules for Python 3 + * Mon Aug 10 2015 Sandro Mani 3-1 - Also handle binaries in $MPI_FORTRAN_MOD_DIR and $MPI_PYTHON_SITEARCH