python-mpmath/python-mpmath.spec
2023-04-26 16:34:46 +08:00

126 lines
3.7 KiB
RPMSpec

%global _empty_manifest_terminate_build 0
Name: python-mpmath
Version: 1.3.0
Release: 1
Summary: Python library for arbitrary-precision floating-point arithmetic
License: BSD-3-Clause
URL: http://github.com/fredrik-johansson/mpmath
Source0: https://github.com/fredrik-johansson/mpmath/archive/%{version}/mpmath-%{version}.tar.gz
BuildArch: noarch
%description
A Python library for arbitrary-precision floating-point arithmetic.
%package -n python3-mpmath
Summary: Python library for arbitrary-precision floating-point arithmetic
Provides: python-mpmath
Recommends: python3-matplotlib
BuildRequires: python3-devel
BuildRequires: python3-pip
BuildRequires: python3-setuptools
BuildRequires: python3-setuptools_scm
BuildRequires: python3-pytest
BuildRequires: python3-pytest-cov
BuildRequires: python3-pycodestyle
BuildRequires: python3-codecov
BuildRequires: python3-wheel
BuildRequires: xorg-x11-server-Xvfb
%description -n python3-mpmath
A Python library for arbitrary-precision floating-point arithmetic.
If you require plotting capabilities in mpmath, install python3-matplotlib.
%package help
Summary: Development documents and examples for mpmath
Provides: python3-mpmath-doc
BuildRequires: python3-sphinx
BuildRequires: dvipng
BuildRequires: latexmk
BuildRequires: texlive-collection-basic
BuildRequires: texlive-collection-latexrecommended
BuildRequires: texlive-collection-latexextra
BuildRequires: texlive-collection-fontsrecommended
%description help
A Python library for arbitrary-precision floating-point arithmetic.
%prep
%autosetup -n mpmath-%{version}
# Convert line encodings
for doc in CHANGES LICENSE README.rst TODO mpmath/tests/runtests.py; do
sed "s|\r||g" $doc > $doc.new && \
touch -r $doc $doc.new && \
mv $doc.new $doc
done
find docs -name *.txt -exec sed -i "s|\r||g" {} \;
shebangs="mpmath/matrices/eigen.py mpmath/matrices/eigen_symmetric.py mpmath/tests/runtests.py mpmath/tests/test_eigen.py mpmath/tests/test_eigen_symmetric.py mpmath/tests/test_levin.py"
# Get rid of unnecessary shebangs
for lib in $shebangs; do
sed '/^#!.*/d; 1q' $lib > $lib.new && \
touch -r $lib $lib.new && \
mv $lib.new $lib
done
sed -i -r 's/use_scm_version=True/version="%{version}"/' setup.py
%build
%py3_build
# Build documentation
%{__python3} setup.py build_sphinx -c docs -b html,latex
make -C build/sphinx/latex all-pdf
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%check
cd build/lib/mpmath/tests/
xvfb-run -a pytest-3 -v
%files -n python3-mpmath -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Wed Apr 26 2023 wangkai <13474090681@163.com> - 1.3.0-1
- Upgrade package to version 1.3.0
* Wed Sep 28 2022 guozhengxin <guozhengxin@kylinos.cn> - 1.2.1-1
- Upgrade package to version 1.2.1
* Tue May 10 2022 xigaoxinyan <xigaoxinyan@h-partners.com> - 1.2.0-2
- License compliance rectification
* Wed Jul 08 2021 liuliang <liuliang1@kylinos.cn> - 1.2.0-1
- Package init