Make the package Red Hat Enterprise Linux friendly

Red Hat Enterprise Linux doesn't provide as much packages as Fedora.
python-networkx is just a setools dependency in Red Hat Enterprise
Linux and needs only limited set of functionality covered by small set
of requirements.

- BuildRequires are limited to necessary minimum and pytest is skipped
  in Red Hat Enterprise Linux

- -doc subpackage is not built for Red Hat Enterprise Linux
This commit is contained in:
Petr Lautrbach 2020-12-11 10:22:35 +01:00
parent 503fc314c3
commit 27bee4b858

View File

@ -2,7 +2,7 @@
Name: python-%{srcname}
Version: 2.5
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Creates and Manipulates Graphs and Networks
License: BSD
URL: http://networkx.github.io/
@ -12,13 +12,16 @@ Patch0: %{name}-doc.patch
BuildArch: noarch
BuildRequires: make
BuildRequires: python3-devel
BuildRequires: %{py3_dist setuptools}
%if 0%{?rhel} == 0
BuildRequires: fontawesome-fonts-web
BuildRequires: font(fontawesome)
BuildRequires: font(lato)
BuildRequires: font(robotoslab)
BuildRequires: fontconfig
BuildRequires: make
BuildRequires: python3-devel
BuildRequires: python3-docs
BuildRequires: python3-numpy-doc
BuildRequires: %{py3_dist decorator}
@ -36,7 +39,6 @@ BuildRequires: %{py3_dist pytest}
BuildRequires: %{py3_dist pytest-cov}
BuildRequires: %{py3_dist pyyaml}
BuildRequires: %{py3_dist scipy}
BuildRequires: %{py3_dist setuptools}
BuildRequires: %{py3_dist sphinx}
BuildRequires: %{py3_dist sphinx-gallery}
BuildRequires: %{py3_dist sphinx-rtd-theme}
@ -46,6 +48,7 @@ BuildRequires: xdg-utils
# Documentation
BuildRequires: tex(latex)
BuildRequires: tex-preview
%endif
%description
NetworkX is a Python package for the creation, manipulation, and
@ -74,6 +77,7 @@ Provides: python3-%{srcname}-test = %{version}-%{release}
NetworkX is a Python 3 package for the creation, manipulation, and
study of the structure, dynamics, and functions of complex networks.
%if 0%{?rhel} == 0
%package doc
Summary: Documentation for networkx
Requires: fontawesome-fonts-web
@ -85,6 +89,7 @@ Provides: bundled(js-underscore)
%description doc
Documentation for networkx
%endif
%prep
%autosetup -p0 -n %{srcname}-%{srcname}-%{version}
@ -106,6 +111,7 @@ sed -e "s|'https://docs\.python\.org/2/': None|'https://docs.python.org/': '%{_d
%build
%py3_build
%if 0%{?rhel} == 0
# Build the documentation
PYTHONPATH=$PWD/build/lib make -C doc html
rst2html --no-datestamp README.rst README.html
@ -124,12 +130,14 @@ ln -s $(fc-match -f "%%{file}" "lato") Lato/lato-regular.ttf
ln -s $(fc-match -f "%%{file}" "robotoslab:bold") RobotoSlab/roboto-slab-v7-bold.ttf
ln -s $(fc-match -f "%%{file}" "robotoslab") RobotoSlab/roboto-slab-v7-regular.ttf
cd -
%endif
%install
%py3_install
mv %{buildroot}%{_docdir}/networkx-%{version} ./installed-docs
rm -f installed-docs/INSTALL.txt
%if 0%{?rhel} == 0
# Repack uncompressed zip archives
for fil in $(find doc/build -name \*.zip); do
mkdir zip
@ -139,19 +147,31 @@ for fil in $(find doc/build -name \*.zip); do
cd ..
rm -fr zip
done
%endif
%check
%if 0%{?rhel} == 0
pytest
%endif
%files -n python3-networkx
%if 0%{?rhel} == 0
%doc README.html installed-docs/*
%endif
%license LICENSE.txt
%{python3_sitelib}/networkx*
%if 0%{?rhel} == 0
%files doc
%doc doc/build/html/*
%endif
%changelog
* Fri Dec 11 2020 Petr Lautrbach <plautrba@redhat.com> - 2.5-2
- Limit BuildRequires to necessary minimum in Red Hat Enterprise Linux
- Skip pytest in Red Hat Enterprise Linux
- Do not build -doc subpackage for Red Hat Enterprise Linux
* Sat Aug 22 2020 Jerry James <loganjerry@gmail.com> - 2.5-1
- Version 2.5
- All patches except -doc have been upstreamed; drop them