2017-12-18 08:30:55 +00:00
#
2022-02-03 19:25:15 +00:00
# spec file
2017-12-18 08:30:55 +00:00
#
2022-02-03 19:25:15 +00:00
# Copyright (c) 2022 SUSE LLC
2017-12-18 08:30:55 +00:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
2020-03-17 13:46:29 +00:00
# Please submit bugfixes or comments via https://bugs.opensuse.org/
2017-12-18 08:30:55 +00:00
#
2020-03-17 13:46:29 +00:00
2022-02-03 19:25:15 +00:00
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%bcond_without test
%define psuffix -test
%else
%bcond_with test
%define psuffix %{nil}
%endif
2017-12-18 08:30:55 +00:00
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
2020-11-19 16:31:45 +00:00
# Upstream no longer supports python2
%define skip_python2 1
%define pyname Mathics3
2022-02-03 19:25:15 +00:00
Name : python-Mathics%{psuffix}
Version : 4.0.0
2017-12-18 08:30:55 +00:00
Release : 0
Summary : A general-purpose computer algebra system
2017-12-20 15:25:13 +00:00
# Mathics itself is licensed as GPL-3.0 but it includes third-party software with MIT, BSD-3-Clause, and Apache-2.0 Licensing; also includes data from wikipedia licensed under CC-BY-SA-3.0 and GFDL-1.3
2021-04-24 07:52:52 +00:00
License : Apache-2.0 AND BSD-3-Clause AND GPL-3.0-only AND MIT
2020-03-17 13:46:29 +00:00
URL : https://mathics.github.io/
2020-11-19 16:31:45 +00:00
Source : https://github.com/mathics/Mathics/archive/%{version} /%{pyname} -%{version} .tar.gz
2022-02-03 19:25:15 +00:00
# PATCH-FIX-UPSTREAM Revert version jump to dev branch
Patch0 : https://github.com/Mathics3/mathics-core/commit/41dee8c9dd7b979a4d77d38a1e8fe8dc75b7638c.patch
BuildRequires : %{python_module Cython}
2020-03-17 13:46:29 +00:00
BuildRequires : %{python_module Django >= 1.8}
2017-12-18 08:30:55 +00:00
BuildRequires : %{python_module colorama}
BuildRequires : %{python_module devel}
BuildRequires : %{python_module mpmath >= 0.19}
2020-03-17 13:46:29 +00:00
BuildRequires : %{python_module numpy}
2017-12-18 08:30:55 +00:00
BuildRequires : %{python_module pexpect}
BuildRequires : %{python_module python-dateutil}
BuildRequires : %{python_module setuptools}
BuildRequires : %{python_module six >= 1.10}
2022-02-03 19:25:15 +00:00
BuildRequires : %{python_module sympy >= 1.8}
2020-03-17 13:46:29 +00:00
BuildRequires : fdupes
BuildRequires : python-rpm-macros
2017-12-18 08:30:55 +00:00
Requires : python-Django >= 1.8
2022-02-03 19:25:15 +00:00
Requires : python-Mathics-Scanner
Requires : python-Pint
Requires : python-llvmlite
2017-12-18 08:30:55 +00:00
Requires : python-mpmath >= 0.19
2022-02-03 19:25:15 +00:00
Requires : python-palettable
2017-12-18 08:30:55 +00:00
Requires : python-python-dateutil
Requires : python-six >= 1.10
2022-02-03 19:25:15 +00:00
Requires : python-sympy >= 1.8
Requires(post) : update-alternatives
Requires(postun) : update-alternatives
%if %{with test}
2020-11-19 16:31:45 +00:00
# SECTION For tests
2022-02-03 19:25:15 +00:00
BuildRequires : %{python_module Mathics}
BuildRequires : %{python_module Mathics-Scanner}
2020-11-19 16:31:45 +00:00
BuildRequires : %{python_module Pint}
BuildRequires : %{python_module chardet}
2022-02-03 19:25:15 +00:00
BuildRequires : %{python_module llvmlite}
2020-11-19 16:31:45 +00:00
BuildRequires : %{python_module palettable}
BuildRequires : %{python_module pytest}
BuildRequires : %{python_module requests}
2022-02-03 19:25:15 +00:00
BuildRequires : %{python_module scipy}
2020-11-19 16:31:45 +00:00
# /SECTION
2022-02-03 19:25:15 +00:00
%endif
2017-12-18 08:30:55 +00:00
%python_subpackages
%description
Mathics is a general-purpose computer algebra system (CAS). It is meant to be a free, lightweight alternative to Mathematica.
%prep
2020-11-19 16:31:45 +00:00
%setup -q -n Mathics-%{version}
2022-02-03 19:25:15 +00:00
%patch0 -p1 -R
2017-12-18 08:30:55 +00:00
# FIX SPURIOUS EXEC PERMISSIONS
chmod -x ./mathics/data/ExampleData/{numberdata.csv,InventionNo1.xml}
# WRONG END-OF-FILE ENCODING
sed -i " s / \r $ / / " ./mathics/data/ExampleData/numberdata.csv
# REMOVE SHEBANGS FROM FILES INSTALLED TO NON-EXEC LOCATIONS
pushd mathics
for d in `find ./ -prune -type d`
do
find ${d} -name " * . p y " -exec sed -i " 1 , 4 { / \ / u s r \ / b i n \ / e n v / d } " '{}' \;
done
popd
%build
2022-02-03 19:25:15 +00:00
%if %{without test}
2017-12-18 08:30:55 +00:00
%python_build
2022-02-03 19:25:15 +00:00
%endif
2017-12-18 08:30:55 +00:00
%install
2022-02-03 19:25:15 +00:00
%if %{without test}
2017-12-18 08:30:55 +00:00
%python_install
2020-05-25 12:16:19 +00:00
%python_clone -a %{buildroot} %{_bindir} /mathics
2022-02-03 19:25:15 +00:00
%python_expand %fdupes %{buildroot} %{$python_sitearch}
%endif
2017-12-18 08:30:55 +00:00
2022-02-03 19:25:15 +00:00
%if %{with test}
2020-03-17 13:46:29 +00:00
%check
2022-02-03 19:25:15 +00:00
# Tests need to be run from the test dir, otherwise some tests in test_files.py fail
pushd test
2020-11-19 16:31:45 +00:00
# Home page tests require django server up and running
2022-02-03 19:25:15 +00:00
%pytest_arch -k 'not test_home_page'
popd
%endif
2017-12-18 08:30:55 +00:00
2022-02-03 19:25:15 +00:00
%if %{without test}
2020-05-25 12:16:19 +00:00
%post
%python_install_alternative mathics
%postun
2022-02-03 19:25:15 +00:00
%python_uninstall_alternative mathics
2020-05-25 12:16:19 +00:00
2020-03-17 13:46:29 +00:00
%files %{python_files}
%license COPYING.txt
%doc README.rst AUTHORS.txt
2020-05-25 12:16:19 +00:00
%python_alternative %{_bindir} /mathics
2022-02-03 19:25:15 +00:00
%{python_sitearch} /mathics/
%{python_sitearch} /%{pyname} -%{version} -py%{python_version} .egg-info/
%endif
2017-12-18 08:30:55 +00:00
%changelog