Dominique Leuenberger 2020-09-25 14:28:03 +00:00 committed by Git OBS Bridge
commit b4a47a76b8
7 changed files with 173 additions and 52 deletions

View File

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

View File

@ -1,31 +1,26 @@
From 71a406f32a654d2037b1d011f44af3fce4d9b50d Mon Sep 17 00:00:00 2001
From 4df3e7cba29a9bb25a70badbc9de8aeef3693933 Mon Sep 17 00:00:00 2001
From: Kasper Peeters <kasper.peeters@phi-sci.com>
Date: Fri, 13 Dec 2019 18:02:59 +0000
Subject: [PATCH] Fix linking of cadabra module.
Date: Fri, 28 Aug 2020 21:12:58 +0100
Subject: [PATCH] Link cadabra2.so to libpython.so if system requires it.
---
cmake/version.cmake | 2 +-
core/CMakeLists.txt | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
core/CMakeLists.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index d9356682ba..8141820ab8 100644
index 1d4c9851da..71570db28f 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -216,6 +218,7 @@ set(LOCAL_SRC_FILES
SympyCdb.cc
YoungTab.cc
modules/xperm_new.cc
+ ${CADABRA_LIBS_DIR}/whereami/whereami.c
${ALGORITHM_SRC_FILES}
${PROPERTY_SRC_FILES}
)
@@ -278,6 +279,8 @@ target_link_libraries(cadabra2 PRIVATE
${GMPXX_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
+ ${PYTHON_LIBRARIES}
+ ${GLIBMM3_LIBRARIES}
)
@@ -305,6 +305,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set_target_properties(cadabra2 PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(cadabra2 PRIVATE ${PYTHON_LIBRARIES})
+elseif(CMAKE_SHARED_LINKER_FLAGS MATCHES ".*-Wl,--no-undefined.*")
+ # Exception for systems that require no undefined symbols present
+ # in shared libraries (e.g. openSUSE).
+ message("-- Linking cadabra2.so to libpython.so because of default linker flags.")
+ target_link_libraries(cadabra2 PRIVATE ${PYTHON_LIBRARIES})
endif()
if(ENABLE_SYSTEM_JSONCPP)
target_link_libraries(cadabra2 PRIVATE

3
cadabra2-2.3.0.tar.gz Normal file
View File

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

View File

@ -1,13 +0,0 @@
Index: cadabra2-2.2.7/CMakeLists.txt
===================================================================
--- cadabra2-2.2.7.orig/CMakeLists.txt
+++ cadabra2-2.2.7/CMakeLists.txt
@@ -120,7 +120,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMP
message(FATAL_ERROR "GCC version must be at least 4.9 for regex support! See http://askubuntu.com/questions/428198/getting-installing-gcc-g-4-9-on-ubuntu and then set the environment variables CXX to g++-4.9 and CC to gcc-4.9. You may have to erase the build directory before re-running cmake.")
endif()
endif()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -Wall -fvisibility=hidden -Wno-unused-but-set-variable")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -Wall -fvisibility=hidden -Wno-unused-but-set-variable -pthread")
endif()
# Clang

View File

@ -0,0 +1,103 @@
Index: cadabra2-2.3.0/CMakeLists.txt
===================================================================
--- cadabra2-2.3.0.orig/CMakeLists.txt
+++ cadabra2-2.3.0/CMakeLists.txt
@@ -231,6 +231,9 @@ endif()
print_header("Configuring Python")
+# NEEDED TO USE CMAKE_INSTALL_FULL<dir>
+include(GNUInstallDirs)
+
if(USE_PYTHON_3)
set(PYTHON_POSTFIX "3")
message(STATUS "Building for use with Python 3 (good!)")
@@ -243,9 +246,17 @@ add_subdirectory(libs/pybind11)
message(STATUS "Found python ${PYTHON_LIBRARIES}")
-# We install the python module in our 'share' path, not in
-# the site-wide path as we used to.
-set(PYTHON_SITE_PATH share/cadabra2/python)
+if(${CMAKE_VERSION} VERSION_LESS 3.12.0)
+ find_package(PythonInterp)
+ set(PYTHON_SITE_PATH ${CMAKE_INSTALL_FULL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
+else()
+ find_package (Python COMPONENTS Interpreter)
+ set(PYTHON_SITE_PATH ${CMAKE_INSTALL_FULL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages)
+endif()
+
+string(REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "" PYTHON_SITE_PATH_REL ${PYTHON_SITE_PATH})
+set(PYTHON_SITE_PATH_REL ${PYTHON_SITE_PATH_REL})
+
if(NOT WIN32)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import site; print (site.getsitepackages()[0]);"
Index: cadabra2-2.3.0/core/cadabra2.in
===================================================================
--- cadabra2-2.3.0.orig/core/cadabra2.in
+++ cadabra2-2.3.0/core/cadabra2.in
@@ -19,10 +19,9 @@ import rlcompleter
import os
# Make sure we can find the cadabra2 python module; is always
-# installed in ../share/cadabra2/python relative to the location
-# of the 'cadabra2' script.
+# installed in PYTHON_SITE_PATH
install_prefix=os.path.realpath(sys.argv[0])
-install_prefix=install_prefix.replace(os.sep+'bin'+os.sep+'cadabra2', os.sep+'share'+os.sep+'cadabra2'+os.sep+'python')
+install_prefix=install_prefix.replace(os.sep+'bin'+os.sep+'cadabra2', '${PYTHON_SITE_PATH_REL}')
# print("Module path ", install_prefix)
sys.path.append(install_prefix)
@@ -256,5 +255,5 @@ if __name__ == '__main__':
# pulling in the right locals/globals
# sh.interact(banner='Info at http://cadabra.phi-sci.com/\nAvailable under the terms of the GNU General Public License v3\n', locals(), globals())
else:
- sh.runsource("import os; import sys; install_prefix=os.path.realpath(sys.argv[0]); install_prefix=install_prefix.replace('/bin/cadabra2','/share/cadabra2/python'); sys.path.append(install_prefix); print('Cadabra @CADABRA_VERSION_MAJOR@.@CADABRA_VERSION_MINOR@.@CADABRA_VERSION_PATCH@ (build @CADABRA_VERSION_BUILD@ dated @CADABRA_VERSION_DATE@)'); print ('Copyright (C) @COPYRIGHT_YEARS@ Kasper Peeters <kasper.peeters@phi-sci.com>'); f=open('${CMAKE_INSTALL_PREFIX}/${PYTHON_SITE_PATH}/cadabra2_defaults.py'); code=compile(f.read(), 'cadabra2_defaults.py', 'exec'); exec(code); f.close(); print('Using SymPy version '+sympy.__version__);")
+ sh.runsource("import os; import sys; install_prefix=os.path.realpath(sys.argv[0]); install_prefix=install_prefix.replace('/bin/cadabra2','${PYTHON_SITE_PATH_REL}'); sys.path.append(install_prefix); print('Cadabra @CADABRA_VERSION_MAJOR@.@CADABRA_VERSION_MINOR@.@CADABRA_VERSION_PATCH@ (build @CADABRA_VERSION_BUILD@ dated @CADABRA_VERSION_DATE@)'); print ('Copyright (C) @COPYRIGHT_YEARS@ Kasper Peeters <kasper.peeters@phi-sci.com>'); f=open('${PYTHON_SITE_PATH}/cadabra2_defaults.py'); code=compile(f.read(), 'cadabra2_defaults.py', 'exec'); exec(code); f.close(); print('Using SymPy version '+sympy.__version__);")
sh.interact(banner='Info at http://cadabra.science/\nAvailable under the terms of the GNU General Public License v3\n')
Index: cadabra2-2.3.0/core/cadabra2-cli.cc
===================================================================
--- cadabra2-2.3.0.orig/core/cadabra2-cli.cc
+++ cadabra2-2.3.0/core/cadabra2-cli.cc
@@ -113,7 +113,7 @@ void Shell::restart()
}
sys = PyImport_ImportModule("sys");
- std::string module_path = cadabra::install_prefix() + "/share/cadabra2/python";
+ std::string module_path = PYTHON_SITE_PATH;
PyObject* module_path_str = PyUnicode_FromString(module_path.c_str());
PyList_Append(PyObject_GetAttrString(sys, "path"), module_path_str);
Py_XDECREF(module_path_str);
@@ -122,7 +122,7 @@ void Shell::restart()
void Shell::interact()
{
// Run cadabra2_defaults.py
- if (!execute_file(cadabra::install_prefix() + "/share/cadabra2/python/cadabra2_defaults.py", false)) {
+ if (!execute_file(std::string(PYTHON_SITE_PATH) + "/cadabra2_defaults.py", false)) {
handle_error();
throw ExitRequest("Error encountered while initializing the interpreter");
}
Index: cadabra2-2.3.0/core/Config.hh.in
===================================================================
--- cadabra2-2.3.0.orig/core/Config.hh.in
+++ cadabra2-2.3.0/core/Config.hh.in
@@ -21,3 +21,4 @@
#define Mathematica_KERNEL_EXECUTABLE "@Mathematica_KERNEL_EXECUTABLE@"
#define PYTHON_SITE_PATH "@PYTHON_SITE_PATH@"
+#define PYTHON_SITE_PATH_REL "@PYTHON_SITE_PATH_REL@"
Index: cadabra2-2.3.0/client_server/Server.cc
===================================================================
--- cadabra2-2.3.0.orig/client_server/Server.cc
+++ cadabra2-2.3.0/client_server/Server.cc
@@ -106,7 +106,7 @@ void Server::init()
// Make the C++ CatchOutput class visible on the Python side.
- auto python_path = cadabra::install_prefix()+"/share/cadabra2/python";
+ auto python_path = std::string(PYTHON_SITE_PATH);
std::string stdOutErr =
"import sys\n"

View File

@ -1,3 +1,36 @@
-------------------------------------------------------------------
Fri Aug 28 20:52:48 UTC 2020 - Atri Bhattacharya <badshah400@gmail.com>
- Refresh Fix-linking-of-cadabra-module.patch with fix for same
issue committed upstream [gh#kpeeters/cadabra2#202].
-------------------------------------------------------------------
Thu Jul 9 22:19:27 UTC 2020 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 2.3.0:
* Fix bug which would collect powers of objects with indices and
then report an error.
* Functionality to read Cadabra Cloud notebooks into the desktop
Cadabra.
* Use a better hash function for expression trees (avoiding a
bug in factor_in).
* Expose index symmetries through traces, so that canonicalise
and related algorithms work correctly. Introduced a new
property TableauInherit.
* More flexible LaTeXForm property, to enable more flexible
object display in the notebook.
* Various fixes for behaviour of unwrap with anti- or
non-commuting arguments.
* New meld algorithm for canonicalisation.
- Drop cadabra2-add-pthread-to-cxxflags.patch: No longer required
for building.
- Add cadabra2-python-modules-location.patch to fix location of
python libs and modules (gh#kpeeters/cadabra2#203).
- Rebase Fix-linking-of-cadabra-module.patch for update; only
partially fixed by upstream (gh#kpeeters/cadabra2#202).
- Remove a hashbang from a non-executable script.
- Use %{name}-%{version} naming format for source.
-------------------------------------------------------------------
Sat Jan 4 01:21:06 UTC 2020 - Stefan Brüns <stefan.bruens@rwth-aachen.de>

View File

@ -17,18 +17,18 @@
Name: cadabra2
Version: 2.2.8
Version: 2.3.0
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
Source0: https://github.com/kpeeters/cadabra2/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: %{name}-gtk.appdata.xml
# PATCH-FIX-OPENSUSE add -pthread to CMAKE_CXX_FLAGS (as adivised in https://github.com/potree/PotreeConverter/issues/136) kkaempf@suse.de
Patch1: cadabra2-add-pthread-to-cxxflags.patch
# PATCH-FIX-UPSTREAM -- https://github.com/kpeeters/cadabra2/commit/71a406f32a654d2037b1d011f44af3fce4d9b50d.patch
# PATCH-FIX-UPSTREAM -- https://github.com/kpeeters/cadabra2/commit/4df3e7cba29a9bb25a70badbc9de8aeef3693933 (gh#kpeeters/cadabra2#202)
Patch2: Fix-linking-of-cadabra-module.patch
# PATCH-FIX-UPSTREAM cadabra2-python-modules-location.patch gh#kpeeters/cadabra2#203 badshah400@gmail.com -- Move python modules to standard python modules path
Patch3: cadabra2-python-modules-location.patch
BuildRequires: appstream-glib
BuildRequires: cmake
BuildRequires: doxygen
@ -117,21 +117,22 @@ This package provides html documentation for %{name}.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
rm examples/.gitignore
# Remove timestamps from Doxygen HTML files
echo "HTML_TIMESTAMP = NO" >> config/Doxyfile
# REMOVE HASHBANG FROM NON-EXEC SCRIPT
sed -i "1{/#!\/usr\/bin\/env python/d}" libs/appdirs/cdb_appdirs.py
%build
%cmake \
-DCMAKE_MANDIR=%{_mandir} \
-DPACKAGING_MODE=ON \
-DINSTALL_LATEX_DIR=%{_datadir}/texmf \
-DENABLE_FRONTEND=ON \
-DENABLE_SYSTEM_JSONPP=ON \
-DENABLE_MATHEMATICA=OFF \
..
-DCMAKE_MANDIR:PATH=%{_mandir} \
-DINSTALL_LATEX_DIR:PATH=%{_datadir}/texmf \
-DENABLE_FRONTEND:BOOL=ON \
-DENABLE_SYSTEM_JSONPP:BOOL=ON \
-DENABLE_MATHEMATICA:BOOL=OFF \
-DBUILD_TESTS:BOOL=ON
%cmake_build
cd ..
@ -162,10 +163,12 @@ ln %{buildroot}%{_datadir}/cadabra2/latex/* %{buildroot}%{_datadir}/texmf/tex/la
%{_bindir}/cadabra2latex
%{_bindir}/cadabra-server
%{_bindir}/%{name}
%{_bindir}/%{name}-cli
%{_bindir}/%{name}python
%{_bindir}/%{name}html
%{_datadir}/%{name}/
%{_datadir}/texmf
%{python3_sitearch}/*
%{_mandir}/man1/cadabra*.1%{?ext_man}
%files gui