Updated for standards per BZ#1433650
This commit is contained in:
parent
259afea88c
commit
b41b8228b2
@ -1,9 +1,3 @@
|
||||
%if 0%{?fedora} > 12
|
||||
%global with_python3 1
|
||||
%else
|
||||
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} == 5
|
||||
%global with_python26 1
|
||||
%endif
|
||||
@ -17,13 +11,15 @@
|
||||
%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
|
||||
|
||||
|
||||
Name: python-pygments
|
||||
Version: 2.2.0
|
||||
Release: 4%{?dist}
|
||||
Summary: Syntax highlighting engine written in Python
|
||||
Release: 5%{?dist}
|
||||
Summary: %{sum}
|
||||
|
||||
Group: Development/Libraries
|
||||
License: BSD
|
||||
@ -32,19 +28,6 @@ Source0: https://pypi.org/packages/source/P/%{upstream_name}/%{upstream_n
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: python2-devel >= 2.4, python-setuptools, python-nose, python-sphinx
|
||||
|
||||
%if 0%{?with_python3}
|
||||
BuildRequires: python3-devel, python3-setuptools, python3-nose
|
||||
# The binary location was moved from Python 2 to Python 3. See BZ#1429075
|
||||
Conflicts: python-pygments < 2.2.0
|
||||
%endif # if with_python3
|
||||
|
||||
%if 0%{?with_python26}
|
||||
BuildRequires: python26-devel, python26-distributea
|
||||
Requires: python26-setuptools
|
||||
%endif
|
||||
|
||||
|
||||
%description
|
||||
Pygments is a generic syntax highlighter for general use in all kinds
|
||||
@ -61,13 +44,21 @@ 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!
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%package -n python3-pygments
|
||||
Summary: Syntax highlighting engine written in Python 3
|
||||
Group: Development/Libraries
|
||||
Requires: python3-setuptools
|
||||
|
||||
%description -n python3-pygments
|
||||
# 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:
|
||||
@ -81,69 +72,85 @@ need to prettify source code. Highlights are:
|
||||
LaTeX and ANSI sequences
|
||||
* it is usable as a command-line tool and as a library
|
||||
* ... and it highlights even Brainf*ck!
|
||||
%endif # if with_python3
|
||||
|
||||
%if 0%{?with_python26}
|
||||
%package -n python26-pygments
|
||||
Summary: A syntax highlighting engine written in Python 2.6
|
||||
Group: Development/Libraries
|
||||
Requires: python26-distribute
|
||||
Requires: python26-imaging
|
||||
Requires: python(abi) = 2.6
|
||||
%else
|
||||
|
||||
%description -n python26-pygments
|
||||
%package -n python2-%{srcname}
|
||||
BuildRequires: python2-devel >= 2.4, python-setuptools, python-nose, python-sphinx
|
||||
Summary: %{sum}
|
||||
%{?python_provide:%python_provide python2-%{srcname}}
|
||||
|
||||
%description -n python2-%{srcname}
|
||||
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:
|
||||
%endif #end of python2.6
|
||||
|
||||
* 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!
|
||||
|
||||
%package -n python3-%{srcname}
|
||||
BuildRequires: python3-devel, python3-setuptools, python3-nose, python3-sphinx
|
||||
Summary: %{sum}
|
||||
%{?python_provide:%python_provide python3-%{srcname}}
|
||||
|
||||
%description -n python3-%{srcname}
|
||||
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!
|
||||
%endif
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n Pygments-%{version}
|
||||
|
||||
%if 0%{?with_python3}
|
||||
rm -rf %{py3dir}
|
||||
cp -a . %{py3dir}
|
||||
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
|
||||
%endif # with_python3
|
||||
|
||||
%if 0%{?with_python26}
|
||||
rm -rf %{py26dir}
|
||||
cp -a . %{py26dir}
|
||||
find %{py26dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python26}|'
|
||||
%endif # with_python26
|
||||
|
||||
%setup -q -n %{upstream_name}-%{version}
|
||||
|
||||
%build
|
||||
%{__python} setup.py build
|
||||
%{__sed} -i 's/\r//' LICENSE
|
||||
|
||||
%if 0%{?with_python3}
|
||||
pushd %{py3dir}
|
||||
%{__python3} setup.py build
|
||||
popd
|
||||
%endif # with_python3
|
||||
|
||||
# Build for python26 or for python2 and python3
|
||||
%if 0%{?with_python26}
|
||||
pushd %{py26dir}
|
||||
%{__python26} setup.py build
|
||||
popd
|
||||
%endif # with_python26
|
||||
|
||||
%else
|
||||
|
||||
%py2_build
|
||||
%py3_build
|
||||
%endif
|
||||
|
||||
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
# Run the Python 2.6 build first so that the Python 2.6 version of
|
||||
# /usr/bin/pygmentize "wins":
|
||||
# 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
|
||||
%endif # with_python26
|
||||
rm -rf %{py26dir}
|
||||
cp -a . %{py26dir}
|
||||
find %{py26dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python26}|'
|
||||
|
||||
# Python2 version
|
||||
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
||||
%else
|
||||
|
||||
%py2_install
|
||||
%{__python} setup.py build_sphinx
|
||||
pushd doc
|
||||
install -d %{buildroot}%{_mandir}/man1
|
||||
@ -151,13 +158,8 @@ mv pygmentize.1 $RPM_BUILD_ROOT%{_mandir}/man1/pygmentize.1
|
||||
popd
|
||||
cp -r doc/docs doc/reST
|
||||
|
||||
# Run the Python 3 build last so that the Python 3 version of
|
||||
# /usr/bin/pygmentize "wins":
|
||||
%if 0%{?with_python3}
|
||||
pushd %{py3dir}
|
||||
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
||||
popd
|
||||
%endif # with_python3
|
||||
%py3_install
|
||||
%endif
|
||||
|
||||
|
||||
%clean
|
||||
@ -167,37 +169,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%check
|
||||
make test || :
|
||||
|
||||
%if 0%{?with_python26}
|
||||
pushd %{py26dir}
|
||||
# There's currently no python26-nose
|
||||
#make test
|
||||
popd
|
||||
%endif # with_python26
|
||||
|
||||
# python3-nose is available from f15 on
|
||||
%if 0%{?with_python3}
|
||||
pushd %{py3dir}
|
||||
%if 0%{?fedora} >= 15
|
||||
make test || :
|
||||
%endif
|
||||
popd
|
||||
%endif # with_python3
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS CHANGES build/sphinx/html doc/reST LICENSE TODO
|
||||
# For noarch packages: sitelib
|
||||
%{python_sitelib}/*
|
||||
%lang(en) %{_mandir}/man1/pygmentize.1.gz
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%files -n python3-pygments
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS CHANGES build/sphinx/html doc/reST LICENSE TODO
|
||||
%{python3_sitelib}/*
|
||||
%{_bindir}/pygmentize
|
||||
%endif # with_python3
|
||||
|
||||
%if 0%{?with_python26}
|
||||
%files -n python26-pygments
|
||||
@ -205,10 +176,29 @@ popd
|
||||
%doc AUTHORS CHANGES doc/ LICENSE TODO
|
||||
%{python26_sitelib}/*
|
||||
%{_bindir}/pygmentize
|
||||
%endif # with_python26
|
||||
|
||||
%else
|
||||
|
||||
%files -n python2-pygments
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS CHANGES build/sphinx/html doc/reST LICENSE TODO
|
||||
# For noarch packages: sitelib
|
||||
%{python_sitelib}/*
|
||||
|
||||
%files -n python3-pygments
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS CHANGES build/sphinx/html doc/reST LICENSE TODO
|
||||
%{python3_sitelib}/*
|
||||
%{_bindir}/pygmentize
|
||||
%lang(en) %{_mandir}/man1/pygmentize.1.gz
|
||||
|
||||
%endif
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Mar 20 2017 Steve Milner <smilner@redhat.com> - 2.2.0-5
|
||||
- Updated for standards per BZ#1433650
|
||||
|
||||
* Mon Mar 6 2017 Steve Milner <smilner@redhat.com> - 2.2.0-4
|
||||
- Added conflict per BZ#1429075
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user