python-pygraphviz/python-pygraphviz.spec

91 lines
2.5 KiB
RPMSpec

Name: python-pygraphviz
Version: 1.6
Release: 1%{?dist}
Summary: Create and Manipulate Graphs and Networks
License: BSD
URL: http://networkx.lanl.gov/pygraphviz/
Source0: https://github.com/pygraphviz/pygraphviz/archive/pygraphviz-%{version}.tar.gz
# Fix a few types in the swig interface
# https://github.com/pygraphviz/pygraphviz
Patch0: pygraphviz-swig.patch
BuildRequires: make
BuildRequires: gcc
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(sphinx)
BuildRequires: python3dist(mock)
BuildRequires: graphviz-devel
BuildRequires: swig
%global _description %{expand:
PyGraphviz is a Python interface to the Graphviz graph layout and
visualization package. With PyGraphviz you can create, edit, read,
write, and draw graphs using Python to access the Graphviz graph data
structure and layout algorithms. PyGraphviz is independent from
NetworkX but provides a similar programming interface.}
%description %_description
%package -n python3-pygraphviz
Summary: %{summary}
%{?python_provide:%python_provide python3-pygraphviz}
%description -n python3-pygraphviz %_description
%package doc
Summary: Documentation for pygraphviz
Provides: bundled(jquery)
BuildArch: noarch
%description doc
Documentation for PyGraphViz.
%prep
%autosetup -p1 -n pygraphviz-pygraphviz-%{version}
# Regenerate the swig-generated files
swig -python pygraphviz/graphviz.i
# Fix the shebangs in the examples
for fil in examples/*.py; do
sed -i.orig 's,%{_bindir}/env python,%{__python3},' $fil
touch -r $fil.orig $fil
rm $fil.orig
done
%build
%py3_build
# docs
%make_build -C doc html PYTHONPATH=$PWD/build/lib.%{python3_platform}-%{python3_version}
%install
%py3_install
mv %{buildroot}%{_docdir}/pygraphviz-* %{buildroot}%{_pkgdocdir}
rm %{buildroot}%{_pkgdocdir}/INSTALL.txt
cp -p README.rst %{buildroot}%{_pkgdocdir}
rm doc/build/html/.buildinfo
cp -av doc/build/html %{buildroot}%{_pkgdocdir}/
chmod g-w %{buildroot}%{python3_sitearch}/pygraphviz/_graphviz.*.so
%global _docdir_fmt %{name}
%files -n python3-pygraphviz
%{python3_sitearch}/pygraphviz*
%exclude %{python3_sitearch}/pygraphviz/graphviz_wrap.c
%doc %dir %{_pkgdocdir}
%doc %{_pkgdocdir}/README.rst
%license LICENSE
%files doc
%doc %dir %{_pkgdocdir}
%doc %{_pkgdocdir}/html
%doc %{_pkgdocdir}/examples
%license LICENSE
%changelog
* Fri Jul 05 2024 ls <liushuai136@h-partners.com> - 1.6-1
- Init for openeuler 22.03-LTS-SP4