Blob Blame History Raw
%global srcname     seqdiag

%if 0%{?fedora}
%global with_python3 1
%endif

Name:           python-%{srcname}
Version:        0.9.5
Release:        9%{?dist}
Summary:        seqdiag generates sequence-diagram images from text

License:        ASL 2.0
URL:            http://blockdiag.com/
Source0:        https://pypi.python.org/packages/source/s/seqdiag/%{srcname}-%{version}.tar.gz
Source1:        description-%{srcname}.txt
Patch0001:      0001-Disable-eggs-downloading-from-pypi.patch

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python-blockdiag-devel
BuildRequires:  python-docutils
BuildRequires:  python-nose
BuildRequires:  python-pep8
BuildRequires:  python-pillow
BuildRequires:  python-reportlab
BuildRequires:  python-setuptools

Requires:       python-blockdiag
Requires:       python-reportlab


%description
%(cat %{SOURCE1})


%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary:        %{summary}

BuildRequires:  python3-blockdiag-devel
BuildRequires:  python3-devel
BuildRequires:  python3-docutils
BuildRequires:  python3-nose
BuildRequires:  python3-pep8
BuildRequires:  python3-pillow
BuildRequires:  python3-reportlab
BuildRequires:  python3-setuptools

Requires:       python3-blockdiag
Requires:       python3-reportlab


%description -n python3-%{srcname}
%(cat %{SOURCE1})

This package installs the %{srcname} module for Python 3.
%endif


%prep
%setup -q -n %{srcname}-%{version}
%patch0001 -p1

# Upstream dropped pep8 tests, they are no longer maintained:
# https://bitbucket.org/blockdiag/seqdiag/commits/671b4b5
rm src/*/tests/test_pep8.py

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif

find           -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'


%build
%{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif


%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
mv %{buildroot}%{_bindir}/%{srcname} %{buildroot}%{_bindir}/%{srcname}-%{python3_version}
install -m 0644 -D %{srcname}.1 %{buildroot}%{_mandir}/man1/%{srcname}-%{python3_version}.1
popd
%endif

%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
install -m 0644 -D %{srcname}.1 %{buildroot}%{_mandir}/man1/%{srcname}.1


%check
%{__python2} setup.py test

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif


%files
%doc LICENSE
%{_bindir}/%{srcname}
%{_mandir}/man1/%{srcname}.1*
%{python2_sitelib}/%{srcname}*
%exclude %{python2_sitelib}/%{srcname}/tests

%if 0%{?with_python3}
%files -n python3-%{srcname}
%{_pkgdocdir}
%{_bindir}/%{srcname}-%{python3_version}
%{_mandir}/man1/%{srcname}-%{python3_version}.1*
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{srcname}*
%exclude %{python3_sitelib}/%{srcname}/tests
%endif


%changelog
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.9.5-7
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-6
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Mon Feb 22 2016 Dridi Boukelmoune <dridi.boukelmoune@gmail.com> - 0.9.5-5
- Drop pep8 test retired upstream

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Sat Sep  5 2015 Haïkel Guémar <hguemar@fedoraproject.org> - 0.9.5-2
- Enable python3 subpackage

* Wed Aug 26 2015 Haïkel Guémar <hguemar@fedoraproject.org> - 0.9.5-1
- Upstream 0.9.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon May 19 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.9.0-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Tue Mar 04 2014 Dridi Boukelmoune <dridi.boukelmoune@gmail.com> - 0.9.0-2
- Fixed changelog format.
- Fixed man page permissions.

* Sun Mar 02 2014 Dridi Boukelmoune <dridi.boukelmoune@gmail.com> - 0.9.0-1
- Initial version.