]>
Commit | Line | Data |
---|---|---|
b039b19f | 1 | # |
8f09c9ec JB |
2 | # Conditional build: |
3 | %bcond_without python2 # CPython 2.x module | |
7f2e3221 | 4 | %bcond_with python3 # CPython 3.x module (built from python3-pygments.spec) |
e96db9a4 JB |
5 | %bcond_without doc # Sphinx documentation |
6 | %bcond_without tests # unit tests | |
6d0d5676 | 7 | |
8f09c9ec JB |
8 | %define module pygments |
9 | Summary: A generic syntax highlighter as Python 2.x module | |
10 | Summary(pl.UTF-8): Moduł Pythona 2.x do ogólnego podświetlania składni | |
5dc968a7 | 11 | Name: python-%{module} |
734c86c9 | 12 | Version: 2.5.2 |
37b19d3b | 13 | Release: 4 |
5dc968a7 | 14 | License: BSD |
15 | Group: Development/Languages/Python | |
734c86c9 | 16 | #Source0Download: https://pypi.org/simple/pygments/ |
ad49381b | 17 | Source0: https://files.pythonhosted.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz |
734c86c9 | 18 | # Source0-md5: 465a35559863089d959d783a69f79b9f |
971b9c53 | 19 | Patch0: rpmspec.patch |
7f2e3221 | 20 | URL: https://pygments.org/ |
de554ad7 | 21 | BuildRequires: rpmbuild(macros) >= 1.714 |
0cfd7bce | 22 | %if %{with python2} |
3bee43f6 JB |
23 | BuildRequires: python >= 1:2.7 |
24 | BuildRequires: python-devel >= 1:2.7 | |
25 | BuildRequires: python-modules >= 1:2.7 | |
343e28d9 | 26 | BuildRequires: python-setuptools |
3bee43f6 | 27 | %if %{with tests} |
734c86c9 | 28 | BuildRequires: python-pytest |
3bee43f6 | 29 | %endif |
0cfd7bce | 30 | %endif |
31 | %if %{with python3} | |
3bee43f6 JB |
32 | BuildRequires: python3 >= 1:3.5 |
33 | BuildRequires: python3-devel >= 1:3.5 | |
34 | BuildRequires: python3-modules >= 1:3.5 | |
343e28d9 | 35 | BuildRequires: python3-setuptools |
3bee43f6 | 36 | %if %{with tests} |
734c86c9 | 37 | BuildRequires: python3-pytest |
3bee43f6 | 38 | %endif |
0cfd7bce | 39 | %endif |
2d23140c | 40 | BuildRequires: rpm-pythonprov |
7f2e3221 | 41 | %{?with_doc:BuildRequires: sphinx-pdg-2} |
3bee43f6 | 42 | Requires: python-modules >= 1:2.7 |
343e28d9 | 43 | Requires: python-setuptools |
ef989146 | 44 | Provides: python-Pygments = %{version}-%{release} |
7f2e3221 | 45 | Obsoletes: python-Pygments < 1.5 |
5dc968a7 | 46 | BuildArch: noarch |
47 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
48 | ||
49 | %description | |
2d23140c | 50 | Pygments is a generic syntax highlighter for general use in all kinds |
51 | of software such as forum systems, wikis or other applications that | |
8f09c9ec | 52 | need to prettify source code. Highlights are: |
5dc968a7 | 53 | - a wide range of common languages and markup formats is supported |
2d23140c | 54 | - special attention is paid to details that increase highlighting |
55 | quality | |
56 | - support for new languages and formats are added easily; most | |
57 | languages use a simple regex-based lexing mechanism | |
58 | - a number of output formats is available, among them HTML, RTF, LaTeX | |
59 | and ANSI sequences | |
5dc968a7 | 60 | - it is usable as a command-line tool and as a library |
61 | - ... and it highlights even Brainf*ck! | |
62 | ||
8f09c9ec JB |
63 | %description -l pl.UTF-8 |
64 | Pygments to moduł Pythona do podświetlania składni ogólnego | |
65 | przeznaczenia we wszelkiego rodzaju programach, takich jaka systemy | |
66 | forów, wiki i inne plikacje wymagające ładnego wyświetlania kodu | |
67 | źródłowego. Zalety Pygments to: | |
68 | - obsługiwany szeroki zakres popularnych języków i formatów znaczników | |
69 | - zwrócenie szczególnej uwagi na szczegóły zwiększające jakość | |
70 | podświetlania | |
71 | - łatwa obsługa nowych języków i formatów; większość języków | |
72 | wykorzystuje prosty mechanizm analizy leksykalnej oparty o wyrażenia | |
73 | regularne | |
74 | - dostępność wielu formatów wyjściowych, m.in. HTML, RTF, LaTeX i | |
75 | sekwencje ANSI | |
76 | - możliwość używania z linii poleceń oraz jako biblioteki | |
77 | - ...a także - podświetla nawet Brainf*cka! | |
78 | ||
b039b19f | 79 | %package -n python3-%{module} |
8f09c9ec JB |
80 | Summary: Generic syntax highlighter as Python 3.x module |
81 | Summary(pl.UTF-8): Moduł Pythona 3.x do ogólnego podświetlania składni | |
b039b19f | 82 | Group: Development/Languages/Python |
3bee43f6 | 83 | Requires: python3-modules >= 1:3.5 |
343e28d9 | 84 | Requires: python3-setuptools |
f111e548 | 85 | Conflicts: python-pygments < 2.5.2 |
b039b19f AF |
86 | |
87 | %description -n python3-%{module} | |
2d23140c | 88 | Pygments is a generic syntax highlighter for general use in all kinds |
89 | of software such as forum systems, wikis or other applications that | |
90 | need to prettify source code. Highlights are | |
b039b19f | 91 | - a wide range of common languages and markup formats is supported |
2d23140c | 92 | - special attention is paid to details that increase highlighting |
93 | quality | |
94 | - support for new languages and formats are added easily; most | |
95 | languages use a simple regex-based lexing mechanism | |
96 | - a number of output formats is available, among them HTML, RTF, LaTeX | |
97 | and ANSI sequences | |
b039b19f AF |
98 | - it is usable as a command-line tool and as a library |
99 | - ... and it highlights even Brainf*ck! | |
100 | ||
8f09c9ec JB |
101 | %description -n python3-%{module} -l pl.UTF-8 |
102 | Pygments to moduł Pythona do podświetlania składni ogólnego | |
103 | przeznaczenia we wszelkiego rodzaju programach, takich jaka systemy | |
104 | forów, wiki i inne plikacje wymagające ładnego wyświetlania kodu | |
105 | źródłowego. Zalety Pygments to: | |
106 | - obsługiwany szeroki zakres popularnych języków i formatów znaczników | |
107 | - zwrócenie szczególnej uwagi na szczegóły zwiększające jakość | |
108 | podświetlania | |
109 | - łatwa obsługa nowych języków i formatów; większość języków | |
110 | wykorzystuje prosty mechanizm analizy leksykalnej oparty o wyrażenia | |
111 | regularne | |
112 | - dostępność wielu formatów wyjściowych, m.in. HTML, RTF, LaTeX i | |
113 | sekwencje ANSI | |
114 | - możliwość używania z linii poleceń oraz jako biblioteki | |
115 | - ...a także - podświetla nawet Brainf*cka! | |
116 | ||
e96db9a4 JB |
117 | %package apidocs |
118 | Summary: API documentation for Python Pygments module | |
119 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona Pygments | |
120 | Group: Documentation | |
121 | ||
122 | %description apidocs | |
123 | API documentation for Python Pygments module. | |
124 | ||
125 | %description apidocs -l pl.UTF-8 | |
126 | Dokumentacja API modułu Pythona Pygments. | |
127 | ||
5dc968a7 | 128 | %prep |
129 | %setup -q -n Pygments-%{version} | |
971b9c53 | 130 | %patch0 -p1 |
5dc968a7 | 131 | |
132 | %build | |
b039b19f | 133 | %if %{with python2} |
cd0bf674 | 134 | %py_build |
e96db9a4 JB |
135 | |
136 | %if %{with tests} | |
734c86c9 | 137 | %{__python} -m pytest tests |
e96db9a4 | 138 | %endif |
b039b19f AF |
139 | %endif |
140 | ||
141 | %if %{with python3} | |
cd0bf674 | 142 | %py3_build |
e96db9a4 JB |
143 | |
144 | %if %{with tests} | |
734c86c9 | 145 | %{__python3} -m pytest tests |
e96db9a4 JB |
146 | %endif |
147 | %endif | |
148 | ||
149 | %if %{with doc} | |
150 | PYTHONPATH=$(pwd) \ | |
7f2e3221 JB |
151 | %{__make} -C doc html \ |
152 | SPHINXBUILD=sphinx-build-2 | |
b039b19f | 153 | %endif |
5dc968a7 | 154 | |
155 | %install | |
156 | rm -rf $RPM_BUILD_ROOT | |
157 | ||
b039b19f | 158 | %if %{with python2} |
cd0bf674 | 159 | %py_install |
b039b19f | 160 | |
de554ad7 | 161 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/pygmentize{,-2} |
5dc968a7 | 162 | |
163 | %py_postclean | |
b039b19f AF |
164 | %endif |
165 | ||
166 | %if %{with python3} | |
cd0bf674 | 167 | %py3_install |
b039b19f | 168 | |
de554ad7 | 169 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/pygmentize{,-3} |
b039b19f AF |
170 | %endif |
171 | ||
734c86c9 JB |
172 | %if %{with python3} |
173 | ln -sf pygmentize-3 $RPM_BUILD_ROOT%{_bindir}/pygmentize | |
8f09c9ec | 174 | %endif |
5dc968a7 | 175 | |
176 | %clean | |
177 | rm -rf $RPM_BUILD_ROOT | |
178 | ||
b039b19f | 179 | %if %{with python2} |
5dc968a7 | 180 | %files |
181 | %defattr(644,root,root,755) | |
734c86c9 | 182 | %doc AUTHORS CHANGES LICENSE README.rst |
b039b19f | 183 | %attr(755,root,root) %{_bindir}/pygmentize-2 |
5dc968a7 | 184 | %{py_sitescriptdir}/%{module} |
8f09c9ec | 185 | %{py_sitescriptdir}/Pygments-%{version}-py*.egg-info |
b039b19f AF |
186 | %endif |
187 | ||
188 | %if %{with python3} | |
189 | %files -n python3-%{module} | |
190 | %defattr(644,root,root,755) | |
734c86c9 JB |
191 | %doc AUTHORS CHANGES LICENSE README.rst |
192 | %attr(755,root,root) %{_bindir}/pygmentize | |
b039b19f AF |
193 | %attr(755,root,root) %{_bindir}/pygmentize-3 |
194 | %{py3_sitescriptdir}/%{module} | |
8f09c9ec | 195 | %{py3_sitescriptdir}/Pygments-%{version}-py*.egg-info |
b039b19f | 196 | %endif |
e96db9a4 JB |
197 | |
198 | %if %{with doc} | |
199 | %files apidocs | |
200 | %defattr(644,root,root,755) | |
201 | %doc doc/_build/html/{_static,docs,*.html,*.js} | |
202 | %endif |