]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without doc # Sphinx documentation | |
4 | %bcond_without tests # unit tests | |
5 | ||
6 | %define module pygments | |
7 | Summary: A generic syntax highlighter as Python 3 module | |
8 | Summary(pl.UTF-8): Moduł Pythona 3 do ogólnego podświetlania składni | |
9 | Name: python3-%{module} | |
10 | Version: 2.14.0 | |
11 | Release: 1 | |
12 | License: BSD | |
13 | Group: Development/Languages/Python | |
14 | #Source0Download: https://pypi.org/simple/pygments/ | |
15 | Source0: https://files.pythonhosted.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz | |
16 | # Source0-md5: 447be4afb076c8325a7dc659aff5b931 | |
17 | Patch0: rpmspec.patch | |
18 | URL: https://pygments.org/ | |
19 | BuildRequires: python3 >= 1:3.6 | |
20 | BuildRequires: python3-devel >= 1:3.6 | |
21 | BuildRequires: python3-modules >= 1:3.6 | |
22 | BuildRequires: python3-setuptools | |
23 | %if %{with tests} | |
24 | BuildRequires: python3-pytest >= 7 | |
25 | BuildRequires: python3-wcag_contrast_ratio | |
26 | %endif | |
27 | BuildRequires: rpm-pythonprov | |
28 | BuildRequires: rpmbuild(macros) >= 1.714 | |
29 | %{?with_doc:BuildRequires: sphinx-pdg} | |
30 | Requires: python3-modules >= 1:3.6 | |
31 | Requires: python3-setuptools | |
32 | Conflicts: python-pygments < 2.5.2 | |
33 | BuildArch: noarch | |
34 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
35 | ||
36 | %description | |
37 | Pygments is a generic syntax highlighter for general use in all kinds | |
38 | of software such as forum systems, wikis or other applications that | |
39 | need to prettify source code. Highlights are: | |
40 | - a wide range of common languages and markup formats is supported | |
41 | - special attention is paid to details that increase highlighting | |
42 | quality | |
43 | - support for new languages and formats are added easily; most | |
44 | languages use a simple regex-based lexing mechanism | |
45 | - a number of output formats is available, among them HTML, RTF, LaTeX | |
46 | and ANSI sequences | |
47 | - it is usable as a command-line tool and as a library | |
48 | - ... and it highlights even Brainf*ck! | |
49 | ||
50 | %description -l pl.UTF-8 | |
51 | Pygments to moduł Pythona do podświetlania składni ogólnego | |
52 | przeznaczenia we wszelkiego rodzaju programach, takich jaka systemy | |
53 | forów, wiki i inne plikacje wymagające ładnego wyświetlania kodu | |
54 | źródłowego. Zalety Pygments to: | |
55 | - obsługiwany szeroki zakres popularnych języków i formatów znaczników | |
56 | - zwrócenie szczególnej uwagi na szczegóły zwiększające jakość | |
57 | podświetlania | |
58 | - łatwa obsługa nowych języków i formatów; większość języków | |
59 | wykorzystuje prosty mechanizm analizy leksykalnej oparty o wyrażenia | |
60 | regularne | |
61 | - dostępność wielu formatów wyjściowych, m.in. HTML, RTF, LaTeX i | |
62 | sekwencje ANSI | |
63 | - możliwość używania z linii poleceń oraz jako biblioteki | |
64 | - ...a także - podświetla nawet Brainf*cka! | |
65 | ||
66 | %package apidocs | |
67 | Summary: API documentation for Python Pygments module | |
68 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona Pygments | |
69 | Group: Documentation | |
70 | ||
71 | %description apidocs | |
72 | API documentation for Python Pygments module. | |
73 | ||
74 | %description apidocs -l pl.UTF-8 | |
75 | Dokumentacja API modułu Pythona Pygments. | |
76 | ||
77 | %prep | |
78 | %setup -q -n Pygments-%{version} | |
79 | %patch0 -p1 | |
80 | ||
81 | %build | |
82 | %py3_build | |
83 | ||
84 | %if %{with tests} | |
85 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
86 | %{__python3} -m pytest tests | |
87 | %endif | |
88 | ||
89 | %if %{with doc} | |
90 | PYTHONPATH=$(pwd) \ | |
91 | %{__make} -C doc html | |
92 | %endif | |
93 | ||
94 | %install | |
95 | rm -rf $RPM_BUILD_ROOT | |
96 | ||
97 | %py3_install | |
98 | ||
99 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/pygmentize{,-3} | |
100 | ||
101 | ln -sf pygmentize-3 $RPM_BUILD_ROOT%{_bindir}/pygmentize | |
102 | ||
103 | %clean | |
104 | rm -rf $RPM_BUILD_ROOT | |
105 | ||
106 | %files | |
107 | %defattr(644,root,root,755) | |
108 | %doc AUTHORS CHANGES LICENSE README.rst | |
109 | %attr(755,root,root) %{_bindir}/pygmentize | |
110 | %attr(755,root,root) %{_bindir}/pygmentize-3 | |
111 | %{py3_sitescriptdir}/pygments | |
112 | %{py3_sitescriptdir}/Pygments-%{version}-py*.egg-info | |
113 | ||
114 | %if %{with doc} | |
115 | %files apidocs | |
116 | %defattr(644,root,root,755) | |
117 | %doc doc/_build/html/{_static,docs,*.html,*.js} | |
118 | %endif |