diff --git a/_service b/_service new file mode 100644 index 0000000..750340c --- /dev/null +++ b/_service @@ -0,0 +1,18 @@ + + + + https://github.com/kpeeters/cadabra2.git + git + 2.5.4 + @PARENT_TAG@ + cadabra2 + enable + + + + *.tar + xz + + + + diff --git a/cadabra2-2.4.5.6.tar.gz b/cadabra2-2.4.5.6.tar.gz deleted file mode 100644 index 1f46441..0000000 --- a/cadabra2-2.4.5.6.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9a3ebe3debd6efdd5f20a3c78acc2ef8933135d5f43da39b6ea107be94a9413c -size 26827151 diff --git a/cadabra2-2.5.4.obscpio b/cadabra2-2.5.4.obscpio new file mode 100644 index 0000000..383a92c --- /dev/null +++ b/cadabra2-2.5.4.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f130d667383d2504e4b36f468684b86f01730a86051d98d65409f0635e35e3ac +size 87038478 diff --git a/cadabra2-cmake-correct-python-variable.patch b/cadabra2-cmake-correct-python-variable.patch new file mode 100644 index 0000000..bdbfdca --- /dev/null +++ b/cadabra2-cmake-correct-python-variable.patch @@ -0,0 +1,86 @@ +Index: cadabra2-2.5.4/CMakeLists.txt +=================================================================== +--- cadabra2-2.5.4.orig/CMakeLists.txt ++++ cadabra2-2.5.4/CMakeLists.txt +@@ -325,7 +325,7 @@ else() + # calling into python's 'site' package (and hoping that the 0th + # element is where we should be writing). + execute_process( +- COMMAND ${PYTHON_EXECUTABLE} -c "import site; print(site.getsitepackages()[0])" ++ COMMAND ${Python_EXECUTABLE} -c "import site; print(site.getsitepackages()[0])" + OUTPUT_VARIABLE PYTHON_SITE_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +@@ -339,7 +339,7 @@ message(STATUS "Installing Python module + # contain the abi name. See + # https://www.python.org/dev/peps/pep-3149/ + execute_process( +- COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))" ++ COMMAND ${Python_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))" + OUTPUT_VARIABLE PYTHON_SOABI + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +@@ -350,7 +350,7 @@ set(PYTHON_SITE_PATH_REL ${PYTHON_SITE_P + + if(NOT WIN32) + execute_process( +- COMMAND ${PYTHON_EXECUTABLE} -c "import site; print (site.getsitepackages()[0]);" ++ COMMAND ${Python_EXECUTABLE} -c "import site; print (site.getsitepackages()[0]);" + OUTPUT_VARIABLE OLDER_PYTHON_SITE_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +Index: cadabra2-2.5.4/core/cadabra2.in +=================================================================== +--- cadabra2-2.5.4.orig/core/cadabra2.in ++++ cadabra2-2.5.4/core/cadabra2.in +@@ -1,4 +1,4 @@ +-#!${PYTHON_EXECUTABLE} ++#!${Python_EXECUTABLE} + # + # \ingroup pythoncore + # +@@ -119,8 +119,8 @@ if __name__ == '__main__': + + if len(sys.argv)>1: + if '-d' in sys.argv: +- #rs = "lldb -ex r --args ${PYTHON_EXECUTABLE} "+sys.argv[0]; +- rs = "gdb -q -ex r --args ${PYTHON_EXECUTABLE} "+sys.argv[0]; ++ #rs = "lldb -ex r --args ${Python_EXECUTABLE} "+sys.argv[0]; ++ rs = "gdb -q -ex r --args ${Python_EXECUTABLE} "+sys.argv[0]; + for a in sys.argv[1:]: + if a!='-d': + rs += " "+a +Index: cadabra2-2.5.4/jupyterkernel/kernelspec/kernel.json.in +=================================================================== +--- cadabra2-2.5.4.orig/jupyterkernel/kernelspec/kernel.json.in ++++ cadabra2-2.5.4/jupyterkernel/kernelspec/kernel.json.in +@@ -1,6 +1,6 @@ + { + "argv": [ +- "@PYTHON_EXECUTABLE@", "-m", "cadabra2_jupyter", "-f", "{connection_file}" ++ "@Python_EXECUTABLE@", "-m", "cadabra2_jupyter", "-f", "{connection_file}" + ], + "display_name":"Cadabra2", + "language":"python" +Index: cadabra2-2.5.4/tests/CMakeLists.txt +=================================================================== +--- cadabra2-2.5.4.orig/tests/CMakeLists.txt ++++ cadabra2-2.5.4/tests/CMakeLists.txt +@@ -49,7 +49,7 @@ foreach(NBTEST ${NBTESTS}) + ARGS ${CNBIN}/${NBTEST}.cnb ${CDBOUT}/${NBTEST}.cdb + COMMENT "Creating ${NBTEST} notebook...") + add_custom_target("${NBTEST}_test" ALL DEPENDS ${CDBOUT}/${NBTEST}.cdb) +- add_test(${NBTEST} ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/core/cadabra2 ${CDBOUT}/${NBTEST}.cdb) ++ add_test(${NBTEST} ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/core/cadabra2 ${CDBOUT}/${NBTEST}.cdb) + set_tests_properties(${NBTEST} PROPERTIES ENVIRONMENT "PYTHONPATH=${PYTHONPATH};LANG=en_US.UTF-8;LC_ALL=en_US.UTF-8;PYTHONIOENCODING=utf-8") + endforeach() + +@@ -100,7 +100,7 @@ if(MATHEMATICA_FOUND) + set(RTESTS ${RTESTS} mma) + endif() + foreach(RTEST ${RTESTS}) +- add_test(${RTEST} ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/core/cadabra2 ${CMAKE_SOURCE_DIR}/tests/${RTEST}.cdb) ++ add_test(${RTEST} ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/core/cadabra2 ${CMAKE_SOURCE_DIR}/tests/${RTEST}.cdb) + # We need to set the Python path so that we pick up the correct cadabra2.so Python module + # even if we did not do 'make install' yet. + set_tests_properties(${RTEST} PROPERTIES ENVIRONMENT "PYTHONPATH=${PYTHONPATH};LANG=en_US.UTF-8;LC_ALL=en_US.UTF-8;PYTHONIOENCODING=utf-8") diff --git a/cadabra2-gtk.appdata.xml b/cadabra2-gtk.appdata.xml deleted file mode 100644 index fbfaede..0000000 --- a/cadabra2-gtk.appdata.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - cadabra2-gtk.desktop - CC0-1.0 - Cadabra 2 - GPL-3.0+ - A computer algebra system for problems in field theory - http://cadabra.science/ - -

Cadabra2 is a computer algebra system (CAS) designed specifically for -the solution of problems encountered in field theory.

-

It has been designed specifically for the solution of problems encountered -in quantum and classical field theory. It has extensive functionality -for tensor computer algebra, tensor polynomial simplification -including multi-term symmetries, fermions and anti-commuting -variables, Clifford algebras and Fierz transformations, implicit -coordinate dependence, multiple index types and many more. The input -format is a subset of TeX.

-
- - - https://cadabra.science/static/images/screenshot.png - Gamma matrix algebra in a Cadabra2 notebook - - - info@cadabra.science -
diff --git a/cadabra2-link-gmp.patch b/cadabra2-link-gmp.patch new file mode 100644 index 0000000..8084892 --- /dev/null +++ b/cadabra2-link-gmp.patch @@ -0,0 +1,14 @@ +Index: cadabra2-2.5.4/core/packages/CMakeLists.txt +=================================================================== +--- cadabra2-2.5.4.orig/core/packages/CMakeLists.txt ++++ cadabra2-2.5.4/core/packages/CMakeLists.txt +@@ -67,7 +67,7 @@ foreach(PACKAGE ${COMPILED_PACKAGES}) + set_target_properties(${PNAME} PROPERTIES SUFFIX ".${PYTHON_MOD_SUFFIX}") + set_target_properties(${PNAME} PROPERTIES INSTALL_RPATH "$ORIGIN/../../:$ORIGIN/../../../../") + +- target_link_libraries(${PNAME} PUBLIC cadabra2 ${GMPXX_LIBRARIES}) ++ target_link_libraries(${PNAME} PUBLIC cadabra2 ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}) + target_include_directories(${PNAME} PUBLIC ${CADABRA_CORE_DIR}) + + if(IPO_SUPPORTED) + diff --git a/cadabra2-link-python.patch b/cadabra2-link-python.patch deleted file mode 100644 index fec8e89..0000000 --- a/cadabra2-link-python.patch +++ /dev/null @@ -1,27 +0,0 @@ -Index: cadabra2-2.4.5.6/core/CMakeLists.txt -=================================================================== ---- cadabra2-2.4.5.6.orig/core/CMakeLists.txt -+++ cadabra2-2.4.5.6/core/CMakeLists.txt -@@ -294,7 +294,7 @@ target_link_libraries(cadabra2 PRIVATE - ${GMPXX_LIBRARIES} - ${GMP_LIBRARIES} - ${Boost_LIBRARIES} --# ${PYTHON_LIBRARIES} -+ ${PYTHON_LIBRARIES} - # ${GLIBMM3_LIBRARIES} - ) - -Index: cadabra2-2.4.5.6/core/packages/CMakeLists.txt -=================================================================== ---- cadabra2-2.4.5.6.orig/core/packages/CMakeLists.txt -+++ cadabra2-2.4.5.6/core/packages/CMakeLists.txt -@@ -66,8 +66,7 @@ foreach(PACKAGE ${COMPILED_PACKAGES}) - set_target_properties(${PNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cdb/${PINSTALL}") - set_target_properties(${PNAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cdb/${PINSTALL}") - set_target_properties(${PNAME} PROPERTIES SUFFIX ".${PYTHON_MOD_SUFFIX}") -- -- target_link_libraries(${PNAME} PUBLIC cadabra2 ${GMPXX_LIBRARIES}) -+ target_link_libraries(${PNAME} PUBLIC cadabra2 ${PYTHON_LIBRARIES} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}) - target_include_directories(${PNAME} PUBLIC ${CADABRA_CORE_DIR}) - - if(IPO_SUPPORTED) diff --git a/cadabra2-use-system-pybind11.patch b/cadabra2-use-system-pybind11.patch new file mode 100644 index 0000000..b90ebf5 --- /dev/null +++ b/cadabra2-use-system-pybind11.patch @@ -0,0 +1,20 @@ +--- + CMakeLists.txt | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +Index: cadabra2-2.5.4/CMakeLists.txt +=================================================================== +--- cadabra2-2.5.4.orig/CMakeLists.txt ++++ cadabra2-2.5.4/CMakeLists.txt +@@ -297,7 +297,10 @@ set(PYTHON_POSTFIX "3") + # message(STATUS "Building for use with Python 3 (good!)") + + find_package(Python COMPONENTS Interpreter Development) +-add_subdirectory(libs/pybind11) ++find_package(pybind11 CONFIG) ++if (NOT pybind11_FOUND) ++ add_subdirectory(libs/pybind11) ++endif() + + message(STATUS "Found python ${PYTHON_LIBRARIES}") + #find_package (Python COMPONENTS Interpreter) diff --git a/cadabra2.changes b/cadabra2.changes index dc58cc1..9697193 100644 --- a/cadabra2.changes +++ b/cadabra2.changes @@ -1,3 +1,50 @@ +------------------------------------------------------------------- +Mon Aug 12 04:32:18 UTC 2024 - Atri Bhattacharya + +- Update to version 2.5.2: + * Fix simplification of pow nodes. + * Make ExNode iterators skip nodes hidden by zoom. + * Fix canonicalise acting on expressions with + self-anticommuting objects and derivatives. + * Fix crash when comparing with empty expressions. + * Make zoom accept a list of patterns. + * Fix bugs in getting Weight values from Python, and setting + multipliers in Python. + * Add LaTeXString object to display LaTeX formatted strings on + capable frontends. + * Fix a bug with canonicalise acting on vector-spinor objects. + * Enable the use of Unicode greek characters as input (which + will get converted to LaTeX automatically) to enable + cut-n-paste in the terminal. + * Fix handling of multi-line expressions (newlines now count as + a whitespace). + * Fix canonicalise to allow for factors which are sums, as long + as these do not have indices. + * Ability to use builtin MicroTeX for typesetting (the default + in 2.5.x), which removes the requirement to have a LaTeX + installation. + * Experimental AppImages now available for Linux on both x86-64 + and aarch64 architectures. + * Removed deprecated GTK-3 features and cleaned up the UI. + * Fix bug in code to interrupt a running computation. + * Added dynamical cell updates, e.g. to create animations. +- Add _service file to fetch sources from git to allow submodules + to be included in tarball. +- Add patches to fix build: + * cadabra2-cmake-correct-python-variable.patch: Use correct + variable from FindPython, i.e. Python_EXECUTABLE, not + PYTHON_EXECUTABLE (gh#kpeeters/cadabra2#309). + * cadabra2-use-system-pybind11.patch: Allow use of system + pybind11 (gh#kpeeters/cadabra2#310). + * cadabra2-link-gmp.patch: Explicitly link to gmp library. +- Drop cadabra2-link-python.patch: upstreamed. +- Drop use of %suse_update_desktop_file: no longer needed. +- Drop appdata file included as Source1, bundled files are now + installed correctly. +- Use python-rpm-macros and setup to build with newer pythons on + Leap 15.X (does not yet work due to unavailability of + python311-sympy and python311-ipykernel on these distros). + ------------------------------------------------------------------- Thu Apr 18 19:37:14 UTC 2024 - Atri Bhattacharya diff --git a/cadabra2.obsinfo b/cadabra2.obsinfo new file mode 100644 index 0000000..fea8efd --- /dev/null +++ b/cadabra2.obsinfo @@ -0,0 +1,4 @@ +name: cadabra2 +version: 2.5.4 +mtime: 1723292700 +commit: 940443b1e78b2b191caa23307c74703202bedf13 diff --git a/cadabra2.spec b/cadabra2.spec index 984ae7f..411914e 100644 --- a/cadabra2.spec +++ b/cadabra2.spec @@ -16,20 +16,38 @@ # +# Disable testing for 32-bit due to invalid free issue in test canonicalise: https://github.com/kpeeters/cadabra2/issues/280 +%ifarch %ix86 +%bcond_with tests +%else %bcond_without tests +%endif +%{?sle15_python_module_pythons} +%if 0%{?suse_version} > 1650 +%global pythons python3 +%endif Name: cadabra2 -Version: 2.4.5.6 +Version: 2.5.4 Release: 0 Summary: A computer algebra system for solving problems in field theory License: GPL-3.0-or-later Group: Productivity/Scientific/Math URL: https://cadabra.science/ -Source0: https://github.com/kpeeters/cadabra2/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz -Source1: %{name}-gtk.appdata.xml +Source0: %{name}-%{version}.tar.xz # PATCH-FIX-UPSTREAM cadabra2-disable-components-test.patch gh#kpeeters/cadabra2#212 badshah400@gmail.com -- Disable a test that crashes for unknown reasons Patch0: cadabra2-disable-components-test.patch -# PATCH-FIX-UPSTREAM cadabra2-link-python.patch badshah400@gmail.com -- Link against python shared lib explicitly -Patch1: cadabra2-link-python.patch +# PATCH-FIX-UPSTREAM cadabra2-link-gmp.patch badshah400@gmail.com -- Link against gmp shared lib explicitly +Patch1: cadabra2-link-gmp.patch +# PATCH-FIX-UPSTREAM cadabra2-use-system-pybind11.patch gh#kpeeters/cadabra2#310 badshah400@gmail.com -- Allow use of system pybind11, fall back to bundled sources if not found +Patch2: cadabra2-use-system-pybind11.patch +# PATCH-FIX-UPSTREAM cadabra2-cmake-correct-python-variable.patch gh#kpeeters/cadabra2#309 badshah400@gmail.com -- Use correct variable set by cmake FindPython, i.e. Python_EXECUTABLE, not PYTHON_EXECUTABLE +Patch3: cadabra2-cmake-correct-python-variable.patch +BuildRequires: %{python_module devel >= 3.9} +BuildRequires: %{python_module gobject-devel} +BuildRequires: %{python_module ipykernel} +BuildRequires: %{python_module matplotlib} +BuildRequires: %{python_module pybind11-devel} +BuildRequires: %{python_module sympy} BuildRequires: appstream-glib BuildRequires: cmake BuildRequires: doxygen @@ -46,11 +64,7 @@ BuildRequires: libboost_system-devel BuildRequires: libuuid-devel BuildRequires: pcre-devel BuildRequires: pkgconfig -BuildRequires: python3-devel >= 3.9 -BuildRequires: python3-gobject-devel -BuildRequires: python3-ipykernel -BuildRequires: python3-matplotlib -BuildRequires: python3-sympy +BuildRequires: python-rpm-macros BuildRequires: update-desktop-files BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(gtkmm-3.0) @@ -63,7 +77,7 @@ BuildRequires: jupyter-jupyter_core-filesystem %endif # SECTION For test %if %{with tests} -BuildRequires: python3-gmpy2 +BuildRequires: %{python_module gmpy2} %endif # /SECTION Recommends: %{name}-examples @@ -150,13 +164,17 @@ echo "HTML_TIMESTAMP = NO" >> config/Doxyfile sed -i "1{/#!\/usr\/bin\/env python/d}" libs/appdirs/cdb_appdirs.py %build +%{python_expand # %cmake \ -DCMAKE_MANDIR:PATH=%{_mandir} \ -DINSTALL_LATEX_DIR:PATH=%{_datadir}/texmf \ -DENABLE_FRONTEND:BOOL=ON \ -DENABLE_SYSTEM_JSONCPP:BOOL=ON \ -DENABLE_MATHEMATICA:BOOL=OFF \ - -DBUILD_TESTS:BOOL=%{?with_tests:ON}%{!?with_tests:OFF} + -DBUILD_TESTS:BOOL=%{?with_tests:ON}%{!?with_tests:OFF} \ + -DPython_EXECUTABLE=%{_bindir}/$python \ + %{nil} +} %cmake_build cd .. @@ -165,19 +183,9 @@ cd .. %install %cmake_install -%suse_update_desktop_file cadabra2-gtk - -# INSTALL APPDATA TO /usr/share/metainfo -install -D -m0644 %{S:1} %{buildroot}%{_datadir}/metainfo/%{name}-gtk.appdata.xml - -# Replace "/usr/bin/env python3" hashbang by "/usr/bin/python3" -%python3_fix_shebang - mkdir -p %{buildroot}%{_datadir}/texmf/tex/latex/cadabra2/ ln %{buildroot}%{_datadir}/cadabra2/latex/* %{buildroot}%{_datadir}/texmf/tex/latex/cadabra2/ -# Disable testing for 32-bit due to tolerance issues https://github.com/kpeeters/cadabra2/issues/280 -%ifnarch %ix86 %if %{with tests} %check export PATH=${PATH}:%{buildroot}%{_bindir} @@ -187,7 +195,6 @@ export PYTHONDONTWRITEBYTECODE=1 export HOME=`pwd` %ctest %endif -%endif %files %doc README.rst @@ -213,7 +220,7 @@ export HOME=`pwd` %license doc/license.txt %{_bindir}/%{name}-gtk %{_datadir}/icons/hicolor/*/apps/cadabra2-gtk.* -%{_datadir}/applications/cadabra2-gtk.desktop +%{_datadir}/applications/*.cadabra2-gtk.desktop %dir %{_datadir}/metainfo %{_datadir}/metainfo/*.appdata.xml