From 0cc51fc0fb37b96b2fde5423ae5b672a94c96131f2c89c468a80d4ae46fea9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sat, 26 Feb 2022 14:23:30 +0000 Subject: [PATCH] A command line interface to Mathics. OBS-URL: https://build.opensuse.org/package/show/science/python-mathicsscript?expand=0&rev=1 --- .gitattributes | 23 +++++++ .gitignore | 1 + _multibuild | 3 + mathicsscript-4.0.0.tar.gz | 3 + python-mathicsscript.changes | 7 ++ python-mathicsscript.spec | 123 +++++++++++++++++++++++++++++++++++ 6 files changed, 160 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _multibuild create mode 100644 mathicsscript-4.0.0.tar.gz create mode 100644 python-mathicsscript.changes create mode 100644 python-mathicsscript.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..fcc7b97 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + test + diff --git a/mathicsscript-4.0.0.tar.gz b/mathicsscript-4.0.0.tar.gz new file mode 100644 index 0000000..ffe513e --- /dev/null +++ b/mathicsscript-4.0.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c0499a0b793e8ccab8d3992c4ecfb644ee7b69bf9a22c9ff074ad1d0fe27b8c +size 188748 diff --git a/python-mathicsscript.changes b/python-mathicsscript.changes new file mode 100644 index 0000000..98ae986 --- /dev/null +++ b/python-mathicsscript.changes @@ -0,0 +1,7 @@ +------------------------------------------------------------------- +Sat Feb 5 18:37:07 UTC 2022 - Atri Bhattacharya + +- New package. +- Split out tests into its own multiflavor flavor since it needs + to use the mathicsscript binary installed using + update-alternatives. diff --git a/python-mathicsscript.spec b/python-mathicsscript.spec new file mode 100644 index 0000000..aeef361 --- /dev/null +++ b/python-mathicsscript.spec @@ -0,0 +1,123 @@ +# +# spec file for package python-mathicsscript +# +# Copyright (c) 2022 SUSE LLC +# +# 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. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "test" +%define psuffix -test +%bcond_without test +%else +%define psuffix %{nil} +%bcond_with test +%endif +%define skip_python2 1 +%define modname mathicsscript +Name: python-mathicsscript%{psuffix} +Version: 4.0.0 +Release: 0 +Summary: A command line interface to Mathics +License: GPL-3.0-or-later +URL: https://mathics.org/ +Source0: https://github.com/Mathics3/mathicsscript/archive/refs/tags/%{version}.tar.gz#/%{modname}-%{version}.tar.gz +BuildRequires: %{python_module Mathics} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-Cython +Requires: python-PyYAML +Requires: python-colorama +Requires: python-columnize +Requires: python-mathics-pygments +Requires: python-networkx +Requires: python-numpy +Requires: python-prompt_toolkit +Requires: python-requests +Requires: python-term-background +Requires(post): update-alternatives +Requires(postun): update-alternatives +%if %{with test} +# SECTION For tests +BuildRequires: %{python_module Cython} +BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module colorama} +BuildRequires: %{python_module columnize} +BuildRequires: %{python_module mathics-pygments} +BuildRequires: %{python_module mathicsscript} +BuildRequires: %{python_module networkx} +BuildRequires: %{python_module numpy} +BuildRequires: %{python_module prompt_toolkit >= 3.0.18} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests} +BuildRequires: %{python_module term-background} +# /SECTION +%endif +BuildArch: noarch +%python_subpackages + +%description +Mathicsscript is a feature-rich command line interface to Mathics. + +%prep +%autosetup -n %{modname}-%{version} + +%build +%if %{without test} +%python_build +%endif + +%install +%if %{without test} +%python_install +%{python_expand # Miscellaneous fixes +# Clear some unnecessary hashbangs +sed -i "1{\@/usr/bin/env@d}" \ + %{buildroot}%{$python_sitelib}/%{modname}/fake_psviewer.py \ + %{buildroot}%{$python_sitelib}/%{modname}/__main__.py \ + %{buildroot}%{$python_sitelib}/%{modname}/asymptote.py +# Move test dir into main module dir +mv %{buildroot}%{$python_sitelib}/test %{buildroot}%{$python_sitelib}/%{modname}/ +%fdupes %{buildroot}%{$python_sitelib}/%{modname}/ +%fdupes %{buildroot}%{$python_sitelib}/%{modname}-%{version}-py%{$python_version}.egg-info/ +} + +%python_clone -a %{buildroot}%{_bindir}/fake_psviewer.py +%python_clone -a %{buildroot}%{_bindir}/mathicsscript +%endif + +%if %{with test} +%check +%pytest +%endif + +%if %{without test} +%post +%python_install_alternative fake_psviewer.py +%python_install_alternative mathicsscript + +%postun +%python_uninstall_alternative fake_psviewer.py +%python_uninstall_alternative mathicsscript + +%files %{python_files} +%license COPYING.txt +%doc README.rst +%python_alternative %{_bindir}/fake_psviewer.py +%python_alternative %{_bindir}/mathicsscript +%{python_sitelib}/%{modname}/ +%{python_sitelib}/%{modname}-%{version}-py%{python_version}.egg-info/ +%endif + +%changelog