diff --git a/ginac.cmake-find-python.patch b/ginac.cmake-find-python.patch new file mode 100644 index 0000000..fafcba7 --- /dev/null +++ b/ginac.cmake-find-python.patch @@ -0,0 +1,77 @@ +commit 8ae03bd2b1beca9210445aac33e0dcc8e0e90f0b +Author: Till Hofmann +Date: Sat Jul 14 13:00:45 2018 +0200 + + cmake: search for python interpreter and use the found interpreter + + Instead of just calling 'python', find the correct python interpreter + with find_package and use that interpreter when calling python. + + This avoids a bug on systems that do not provide an unversioned python + (i.e., that use 'python2' instead of 'python'). This should also avoid + using the python3 interpeter on accident. + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cdb18f09..33e3f18c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -17,6 +17,8 @@ string(REGEX REPLACE "^.*GINAC_LT_REVISION[ \t]+([0-9]+).*" "\\1" ginac_lt_revis + math(EXPR ginaclib_soversion "${ginac_lt_current} - ${ginac_lt_age}") + set(ginaclib_version ${ginaclib_soversion}.${ginac_lt_age}.${ginac_lt_revision}) + ++find_package(PythonInterp 2 EXACT REQUIRED) ++ + # make check + enable_testing() + add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) +diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt +index e1416d31..7a226a26 100644 +--- a/doc/CMakeLists.txt ++++ b/doc/CMakeLists.txt +@@ -45,7 +45,7 @@ macro(pdflatex_process texfile) + add_custom_command( + OUTPUT ${_ind} + COMMAND ${MAKEINDEX_COMPILER} ${_idx} +- COMMAND python ${_fixupind} ${_idx} ++ COMMAND ${PYTHON_EXECUTABLE} ${_fixupind} ${_idx} + WORKING_DIRECTORY ${_dirname} + DEPENDS ${texfile} ${_idx} + COMMENT "MAKEINDEX ${_basename}.idx") +diff --git a/ginac/CMakeLists.txt b/ginac/CMakeLists.txt +index 27f4db8d..d3d344c1 100644 +--- a/ginac/CMakeLists.txt ++++ b/ginac/CMakeLists.txt +@@ -168,11 +168,11 @@ install(FILES ${ginaclib_public_headers} DESTINATION "${INCLUDE_INSTALL_DIR}/gin + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/function.h +- COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.h ${CMAKE_CURRENT_SOURCE_DIR}/function.hppy ++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.h ${CMAKE_CURRENT_SOURCE_DIR}/function.hppy + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/function.hppy ${CMAKE_CURRENT_SOURCE_DIR}/function.py) + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/function.cpp +- COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.cpp ${CMAKE_CURRENT_SOURCE_DIR}/function.cppy ++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.cpp ${CMAKE_CURRENT_SOURCE_DIR}/function.cppy + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/function.h ${CMAKE_CURRENT_SOURCE_DIR}/function.cppy ${CMAKE_CURRENT_SOURCE_DIR}/function.py) + +diff --git a/ginsh/CMakeLists.txt b/ginsh/CMakeLists.txt +index c350a21a..5e408594 100644 +--- a/ginsh/CMakeLists.txt ++++ b/ginsh/CMakeLists.txt +@@ -40,13 +40,13 @@ endif() + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ginsh_fcn_help.h +- COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_fcn_help.py -o ginsh_fcn_help.h ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in ++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_fcn_help.py -o ginsh_fcn_help.h ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_fcn_help.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ginsh_op_help.h +- COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_op_help.py -o ginsh_op_help.h ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in ++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_op_help.py -o ginsh_op_help.h ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_op_help.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + diff --git a/ginac.spec b/ginac.spec index dfec29a..8ebb09a 100644 --- a/ginac.spec +++ b/ginac.spec @@ -2,11 +2,14 @@ Name: ginac Version: 1.7.4 -Release: 3%{?dist} +Release: 4%{?dist} Summary: C++ library for symbolic calculations License: GPLv2+ URL: https://www.ginac.de/ Source0: https://www.ginac.de/%{name}-%{version}.tar.bz2 +# Submitted upstream: http://www.cebix.net/pipermail/ginac-list/2018-July/002214.html +Patch0: ginac.cmake-find-python.patch + BuildRequires: gcc-c++ BuildRequires: bison BuildRequires: cln-devel @@ -69,6 +72,12 @@ make -C doc/tutorial/ ginac_html rm -frv %{buildroot}%{_infodir}/dir find %{buildroot} -name '*.la' -delete -print +for f in $(find %{buildroot} -name "*.py") ; do + sed -i.orig "s:^#\!/usr/bin/env\s\+python:#!%{__python2}:" $f + touch -r $f.orig $f + rm $f.orig +done + %check make check @@ -100,6 +109,10 @@ fi %{_bindir}/* %changelog +* Sat Jul 14 2018 Till Hofmann - 1.7.4-4 +- Add patch to avoid using unversioned python in cmake +- Replace unversioned python shebangs in all installed python files + * Fri Jul 13 2018 Fedora Release Engineering - 1.7.4-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild