SHA256
1
0
forked from pool/cadabra2
Dominique Leuenberger 2024-08-17 10:44:22 +00:00 committed by Git OBS Bridge
commit af523f3807
11 changed files with 223 additions and 81 deletions

18
_service Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<services>
<service name="obs_scm" mode="manual">
<param name="url">https://github.com/kpeeters/cadabra2.git</param>
<param name="scm">git</param>
<param name="revision">2.5.4</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="filename">cadabra2</param>
<param name="submodules">enable</param>
</service>
<service name="tar" mode="buildtime"/>
<service name="recompress" mode="buildtime">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service name="set_version" mode="buildtime"/>
</services>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9a3ebe3debd6efdd5f20a3c78acc2ef8933135d5f43da39b6ea107be94a9413c
size 26827151

3
cadabra2-2.5.4.obscpio Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f130d667383d2504e4b36f468684b86f01730a86051d98d65409f0635e35e3ac
size 87038478

View File

@ -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")

View File

@ -1,27 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<component>
<id>cadabra2-gtk.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<name>Cadabra 2</name>
<project_license>GPL-3.0+</project_license>
<summary>A computer algebra system for problems in field theory</summary>
<url type="homepage">http://cadabra.science/</url>
<description>
<p>Cadabra2 is a computer algebra system (CAS) designed specifically for
the solution of problems encountered in field theory.</p>
<p>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.</p>
</description>
<screenshots>
<screenshot type="default">
<image height="1440" width="1192">https://cadabra.science/static/images/screenshot.png</image>
<caption>Gamma matrix algebra in a Cadabra2 notebook</caption>
</screenshot>
</screenshots>
<update_contact>info@cadabra.science</update_contact>
</component>

14
cadabra2-link-gmp.patch Normal file
View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -1,3 +1,50 @@
-------------------------------------------------------------------
Mon Aug 12 04:32:18 UTC 2024 - Atri Bhattacharya <badshah400@gmail.com>
- 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 <badshah400@gmail.com> Thu Apr 18 19:37:14 UTC 2024 - Atri Bhattacharya <badshah400@gmail.com>

4
cadabra2.obsinfo Normal file
View File

@ -0,0 +1,4 @@
name: cadabra2
version: 2.5.4
mtime: 1723292700
commit: 940443b1e78b2b191caa23307c74703202bedf13

View File

@ -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 %bcond_without tests
%endif
%{?sle15_python_module_pythons}
%if 0%{?suse_version} > 1650
%global pythons python3
%endif
Name: cadabra2 Name: cadabra2
Version: 2.4.5.6 Version: 2.5.4
Release: 0 Release: 0
Summary: A computer algebra system for solving problems in field theory Summary: A computer algebra system for solving problems in field theory
License: GPL-3.0-or-later License: GPL-3.0-or-later
Group: Productivity/Scientific/Math Group: Productivity/Scientific/Math
URL: https://cadabra.science/ URL: https://cadabra.science/
Source0: https://github.com/kpeeters/cadabra2/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.xz
Source1: %{name}-gtk.appdata.xml
# PATCH-FIX-UPSTREAM cadabra2-disable-components-test.patch gh#kpeeters/cadabra2#212 badshah400@gmail.com -- Disable a test that crashes for unknown reasons # 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 Patch0: cadabra2-disable-components-test.patch
# PATCH-FIX-UPSTREAM cadabra2-link-python.patch badshah400@gmail.com -- Link against python shared lib explicitly # PATCH-FIX-UPSTREAM cadabra2-link-gmp.patch badshah400@gmail.com -- Link against gmp shared lib explicitly
Patch1: cadabra2-link-python.patch 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: appstream-glib
BuildRequires: cmake BuildRequires: cmake
BuildRequires: doxygen BuildRequires: doxygen
@ -46,11 +64,7 @@ BuildRequires: libboost_system-devel
BuildRequires: libuuid-devel BuildRequires: libuuid-devel
BuildRequires: pcre-devel BuildRequires: pcre-devel
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: python3-devel >= 3.9 BuildRequires: python-rpm-macros
BuildRequires: python3-gobject-devel
BuildRequires: python3-ipykernel
BuildRequires: python3-matplotlib
BuildRequires: python3-sympy
BuildRequires: update-desktop-files BuildRequires: update-desktop-files
BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtkmm-3.0) BuildRequires: pkgconfig(gtkmm-3.0)
@ -63,7 +77,7 @@ BuildRequires: jupyter-jupyter_core-filesystem
%endif %endif
# SECTION For test # SECTION For test
%if %{with tests} %if %{with tests}
BuildRequires: python3-gmpy2 BuildRequires: %{python_module gmpy2}
%endif %endif
# /SECTION # /SECTION
Recommends: %{name}-examples 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 sed -i "1{/#!\/usr\/bin\/env python/d}" libs/appdirs/cdb_appdirs.py
%build %build
%{python_expand #
%cmake \ %cmake \
-DCMAKE_MANDIR:PATH=%{_mandir} \ -DCMAKE_MANDIR:PATH=%{_mandir} \
-DINSTALL_LATEX_DIR:PATH=%{_datadir}/texmf \ -DINSTALL_LATEX_DIR:PATH=%{_datadir}/texmf \
-DENABLE_FRONTEND:BOOL=ON \ -DENABLE_FRONTEND:BOOL=ON \
-DENABLE_SYSTEM_JSONCPP:BOOL=ON \ -DENABLE_SYSTEM_JSONCPP:BOOL=ON \
-DENABLE_MATHEMATICA:BOOL=OFF \ -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 %cmake_build
cd .. cd ..
@ -165,19 +183,9 @@ cd ..
%install %install
%cmake_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/ mkdir -p %{buildroot}%{_datadir}/texmf/tex/latex/cadabra2/
ln %{buildroot}%{_datadir}/cadabra2/latex/* %{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} %if %{with tests}
%check %check
export PATH=${PATH}:%{buildroot}%{_bindir} export PATH=${PATH}:%{buildroot}%{_bindir}
@ -187,7 +195,6 @@ export PYTHONDONTWRITEBYTECODE=1
export HOME=`pwd` export HOME=`pwd`
%ctest %ctest
%endif %endif
%endif
%files %files
%doc README.rst %doc README.rst
@ -213,7 +220,7 @@ export HOME=`pwd`
%license doc/license.txt %license doc/license.txt
%{_bindir}/%{name}-gtk %{_bindir}/%{name}-gtk
%{_datadir}/icons/hicolor/*/apps/cadabra2-gtk.* %{_datadir}/icons/hicolor/*/apps/cadabra2-gtk.*
%{_datadir}/applications/cadabra2-gtk.desktop %{_datadir}/applications/*.cadabra2-gtk.desktop
%dir %{_datadir}/metainfo %dir %{_datadir}/metainfo
%{_datadir}/metainfo/*.appdata.xml %{_datadir}/metainfo/*.appdata.xml