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