added Dave Malcolm's patch from BZ 537244

This commit is contained in:
smilner 2010-04-23 15:25:43 +00:00
parent 71d2ba9e15
commit 9faf8bd9dc

View File

@ -1,8 +1,10 @@
%global with_python3 0
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: python-pygments
Version: 1.3.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A syntax highlighting engine written in Python
Group: Development/Libraries
@ -15,6 +17,9 @@ BuildArch: noarch
BuildRequires: python-devel, python-setuptools
Requires: python-setuptools, python-imaging
%if 0%{?with_python3}
BuildRequires: python3-devel, python3-setuptools
%endif # if with_python3
%description
Pygments is a syntax highlighting engine written in Python. That means, it
@ -22,18 +27,50 @@ will take source code (or other markup) in a supported language and output
a processed version (in different formats) containing syntax highlighting
markup.
%if 0%{?with_python3}
%package -n python3-pygments
Summary: A syntax highlighting engine written in Python 3
Group: Development/Libraries
Requires: python3-setuptools
%description -n python3-pygments
Pygments is a syntax highlighting engine written in Python. That means, it
will take source code (or other markup) in a supported language and output
a processed version (in different formats) containing syntax highlighting
markup.
%endif # if with_python3
%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
%build
%{__python} setup.py build
%{__sed} -i 's/\r//' LICENSE
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%install
rm -rf $RPM_BUILD_ROOT
# Run the Python 3 build first so that the Python 2 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
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1/
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
mv docs/pygmentize.1 $RPM_BUILD_ROOT%{_mandir}/man1/pygmentize.1
@ -51,8 +88,17 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/pygmentize
%lang(en) %{_mandir}/man1/pygmentize.1.gz
%if 0%{?with_python3}
%files -n python3-pygments
%defattr(-,root,root,-)
%doc AUTHORS CHANGES docs/ LICENSE TODO
%{python3_sitelib}/*
%endif # with_python3
%changelog
* Fri Apr 23 2010 David Malcolm <dmalcolm@redhat.com> - 1.3.1-3
- add python3 subpackage (BZ#537244), ignoring soft-dep on imaging for now
* Sat Apr 13 2010 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.3.1-2
- added python-imaging as a dependency per BZ#581663.