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