-%bcond_without python2
-%bcond_without python3
-%define module pygments
#
-Summary: Generic syntax highlighter
+# Conditional build:
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+
+%define module pygments
+Summary: A generic syntax highlighter as Python 2.x module
+Summary(pl.UTF-8): Moduł Pythona 2.x do ogólnego podświetlania składni
Name: python-%{module}
-Version: 1.3.1
+Version: 2.2.0
Release: 1
License: BSD
Group: Development/Languages/Python
-Source0: http://pypi.python.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz
-# Source0-md5: 54be67c04834f13d7e255e1797d629a5
+#Source0Download: https://pypi.python.org/simple/Pygments
+Source0: https://files.pythonhosted.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz
+# Source0-md5: 13037baca42f16917cbd5ad2fab50844
+Patch0: rpmspec.patch
URL: http://pygments.org/
-BuildRequires: python-devel
-%pyrequires_eq python-modules
+BuildRequires: rpmbuild(macros) >= 1.714
+%if %{with python2}
+BuildRequires: python >= 1:2.6
+BuildRequires: python-devel >= 1:2.6
+BuildRequires: python-modules >= 1:2.6
+BuildRequires: python-setuptools
+%endif
+%if %{with python3}
+BuildRequires: python3 >= 1:3.2
+BuildRequires: python3-2to3 >= 1:3.2
+BuildRequires: python3-devel >= 1:3.2
+BuildRequires: python3-modules >= 1:3.2
+BuildRequires: python3-setuptools
+%endif
+BuildRequires: rpm-pythonprov
+Requires: python-modules >= 1:2.6
+Requires: python-setuptools
+Provides: python-Pygments = %{version}-%{release}
+Obsoletes: python-Pygments
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-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
+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
+- 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!
+%description -l pl.UTF-8
+Pygments to moduł Pythona do podświetlania składni ogólnego
+przeznaczenia we wszelkiego rodzaju programach, takich jaka systemy
+forów, wiki i inne plikacje wymagające ładnego wyświetlania kodu
+źródłowego. Zalety Pygments to:
+- obsługiwany szeroki zakres popularnych języków i formatów znaczników
+- zwrócenie szczególnej uwagi na szczegóły zwiększające jakość
+ podświetlania
+- łatwa obsługa nowych języków i formatów; większość języków
+ wykorzystuje prosty mechanizm analizy leksykalnej oparty o wyrażenia
+ regularne
+- dostępność wielu formatów wyjściowych, m.in. HTML, RTF, LaTeX i
+ sekwencje ANSI
+- możliwość używania z linii poleceń oraz jako biblioteki
+- ...a także - podświetla nawet Brainf*cka!
+
%package -n python3-%{module}
-Summary: Generic syntax highlighter
+Summary: Generic syntax highlighter as Python 3.x module
+Summary(pl.UTF-8): Moduł Pythona 3.x do ogólnego podświetlania składni
Group: Development/Languages/Python
+Requires: python3-modules >= 1:3.2
+Requires: python3-setuptools
%description -n python3-%{module}
-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
+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
+- 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!
+%description -n python3-%{module} -l pl.UTF-8
+Pygments to moduł Pythona do podświetlania składni ogólnego
+przeznaczenia we wszelkiego rodzaju programach, takich jaka systemy
+forów, wiki i inne plikacje wymagające ładnego wyświetlania kodu
+źródłowego. Zalety Pygments to:
+- obsługiwany szeroki zakres popularnych języków i formatów znaczników
+- zwrócenie szczególnej uwagi na szczegóły zwiększające jakość
+ podświetlania
+- łatwa obsługa nowych języków i formatów; większość języków
+ wykorzystuje prosty mechanizm analizy leksykalnej oparty o wyrażenia
+ regularne
+- dostępność wielu formatów wyjściowych, m.in. HTML, RTF, LaTeX i
+ sekwencje ANSI
+- możliwość używania z linii poleceń oraz jako biblioteki
+- ...a także - podświetla nawet Brainf*cka!
+
%prep
%setup -q -n Pygments-%{version}
+%patch0 -p1
%build
%if %{with python2}
-%{__python} setup.py build -b build-2
+%py_build
%endif
%if %{with python3}
-%{__python3} setup.py build -b build-3
+%py3_build
%endif
%install
rm -rf $RPM_BUILD_ROOT
%if %{with python2}
-%{__python} setup.py \
- build -b build-2 \
- install \
- --optimize=2 \
- --root=$RPM_BUILD_ROOT
+%py_install
-mv $RPM_BUILD_ROOT%{_bindir}/pygmentize{,-2}
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/pygmentize{,-2}
%py_postclean
%endif
%if %{with python3}
-%{__python3} setup.py \
- build -b build-3 \
- install \
- --optimize=2 \
- --root=$RPM_BUILD_ROOT
+%py3_install
-mv $RPM_BUILD_ROOT%{_bindir}/pygmentize{,-3}
-
-%py3_postclean
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/pygmentize{,-3}
%endif
-ln -s pygmentize-2 $RPM_BUILD_ROOT%{_bindir}/pygmentize
+%if %{with python2}
+ln -sf pygmentize-2 $RPM_BUILD_ROOT%{_bindir}/pygmentize
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc PKG-INFO TODO AUTHORS
+%doc AUTHORS CHANGES LICENSE TODO
%attr(755,root,root) %{_bindir}/pygmentize
%attr(755,root,root) %{_bindir}/pygmentize-2
%{py_sitescriptdir}/%{module}
-%{py_sitescriptdir}/*Pygments*.egg*
+%{py_sitescriptdir}/Pygments-%{version}-py*.egg-info
%endif
%if %{with python3}
%files -n python3-%{module}
%defattr(644,root,root,755)
-%doc PKG-INFO TODO AUTHORS
+%doc AUTHORS CHANGES LICENSE TODO
%attr(755,root,root) %{_bindir}/pygmentize-3
%{py3_sitescriptdir}/%{module}
-%{py3_sitescriptdir}/*Pygments*.egg*
+%{py3_sitescriptdir}/Pygments-%{version}-py*.egg-info
%endif