Spec clean up

This commit is contained in:
Steve Milner 2017-03-22 10:22:35 -04:00
parent b41b8228b2
commit c30186407b

View File

@ -1,16 +1,3 @@
%if 0%{?rhel} == 5
%global with_python26 1
%endif
%if 0%{?with_python26}
%global __python26 %{_bindir}/python2.6
%global py26dir %{_builddir}/python26-%{name}-%{version}-%{release}
%{!?python26_sitelib: %global python26_sitelib %(%{__python26} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
# Update rpm byte compilation script so that we get the modules compiled by the
# correct inerpreter
%global __os_install_post %__multiple_python_os_install_post
%endif
%global upstream_name Pygments
%global srcname pygments
%global sum Syntax highlighting engine written in Python
@ -18,14 +5,12 @@
Name: python-pygments
Version: 2.2.0
Release: 5%{?dist}
Release: 6%{?dist}
Summary: %{sum}
Group: Development/Libraries
License: BSD
URL: http://pygments.org/
Source0: https://pypi.org/packages/source/P/%{upstream_name}/%{upstream_name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@ -45,38 +30,9 @@ need to prettify source code. Highlights are:
* ... and it highlights even Brainf*ck!
# We either build for python26 or for python2 and python3
%if 0%{?with_python26}
%package -n python26-pygments
Summary: %{sum}
Group: Development/Libraries
BuildRequires: python26-devel, python26-distributea
Requires: python26-distribute
Requires: python26-imaging
Requires: python(abi) = 2.6
Requires: python26-setuptools
%{?python_provide:%python_provide python26-%{srcname}}
%description -n python26-pygments
Pygments is a generic syntax highlighter for general use in all kinds
of software such as forum systems, wikis or other applications that
need to prettify source code. Highlights are:
* a wide range of common languages and markup formats is supported
* special attention is paid to details that increase highlighting
quality
* support for new languages and formats are added easily; most
languages use a simple regex-based lexing mechanism
* a number of output formats is available, among them HTML, RTF,
LaTeX and ANSI sequences
* it is usable as a command-line tool and as a library
* ... and it highlights even Brainf*ck!
%else
%package -n python2-%{srcname}
BuildRequires: python2-devel >= 2.4, python-setuptools, python-nose, python-sphinx
BuildRequires: python%{?fedora:2}-devel >= 2.4, python%{?fedora:2}-setuptools
BuildRequires: python%{?fedora:2}-nose, python%{?fedora:2}-sphinx
Summary: %{sum}
%{?python_provide:%python_provide python2-%{srcname}}
@ -95,8 +51,10 @@ need to prettify source code. Highlights are:
* it is usable as a command-line tool and as a library
* ... and it highlights even Brainf*ck!
# python3 packages are only built on Fedora
%if 0%{?fedora}
%package -n python3-%{srcname}
BuildRequires: python3-devel, python3-setuptools, python3-nose, python3-sphinx
BuildRequires: python3-devel, python3-setuptools, python3-nose
Summary: %{sum}
%{?python_provide:%python_provide python3-%{srcname}}
@ -116,86 +74,60 @@ need to prettify source code. Highlights are:
* ... and it highlights even Brainf*ck!
%endif
%prep
%setup -q -n %{upstream_name}-%{version}
%build
%{__sed} -i 's/\r//' LICENSE
# Build for python26 or for python2 and python3
%if 0%{?with_python26}
pushd %{py26dir}
%{__python26} setup.py build
popd
%else
%py2_build
# python3 packages are only built on Fedora
%if 0%{?fedora}
%py3_build
%endif
%install
rm -rf $RPM_BUILD_ROOT
# Install for python26 or python2 and python3
%if 0%{?with_python26}
pushd %{py26dir}
%{__python26} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
popd
rm -rf %{py26dir}
cp -a . %{py26dir}
find %{py26dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python26}|'
%else
# Python 2 install
# NOTE: sphinx is built on Python2 and packages with python2 and python3
%py2_install
%{__python} setup.py build_sphinx
%{__python2} setup.py build_sphinx
pushd doc
install -d %{buildroot}%{_mandir}/man1
mv pygmentize.1 $RPM_BUILD_ROOT%{_mandir}/man1/pygmentize.1
popd
cp -r doc/docs doc/reST
# python3 packages are only built on Fedora
%if 0%{?fedora}
# Python 3 install
%py3_install
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%check
make test || :
%if 0%{?with_python26}
%files -n python26-pygments
%defattr(-,root,root,-)
%doc AUTHORS CHANGES doc/ LICENSE TODO
%{python26_sitelib}/*
%{_bindir}/pygmentize
%else
%files -n python2-pygments
%defattr(-,root,root,-)
%doc AUTHORS CHANGES build/sphinx/html doc/reST LICENSE TODO
%doc AUTHORS CHANGES build/sphinx/html doc/reST TODO
%license LICENSE
# For noarch packages: sitelib
%{python_sitelib}/*
# python3 packages are only built on Fedora
%if 0%{?fedora}
%files -n python3-pygments
%defattr(-,root,root,-)
%doc AUTHORS CHANGES build/sphinx/html doc/reST LICENSE TODO
%doc AUTHORS CHANGES build/sphinx/html doc/reST TODO
%license LICENSE
%{python3_sitelib}/*
%{_bindir}/pygmentize
%lang(en) %{_mandir}/man1/pygmentize.1.gz
%lang(en) %{_mandir}/man1/pygmentize.1*
%endif
%changelog
* Wed Mar 22 2017 Steve Milner <smilner@redhat.com> - 2.2.0-6
- Dropped python26 support.
- Spec clean up
* Mon Mar 20 2017 Steve Milner <smilner@redhat.com> - 2.2.0-5
- Updated for standards per BZ#1433650