]>
Commit | Line | Data |
---|---|---|
b039b19f AF |
1 | %bcond_without python2 |
2 | %bcond_without python3 | |
3 | %define module pygments | |
4 | # | |
5dc968a7 | 5 | Summary: Generic syntax highlighter |
6 | Name: python-%{module} | |
0ab78a8b | 7 | Version: 1.4 |
8 | Release: 1 | |
5dc968a7 | 9 | License: BSD |
10 | Group: Development/Languages/Python | |
11 | Source0: http://pypi.python.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz | |
0ab78a8b | 12 | # Source0-md5: d77ac8c93a7fb27545f2522abe9cc462 |
1fcda2a5 | 13 | URL: http://pygments.org/ |
0cfd7bce | 14 | %if %{with python2} |
2d23140c | 15 | BuildRequires: python |
5dc968a7 | 16 | BuildRequires: python-devel |
2d23140c | 17 | BuildRequires: python-modules |
0cfd7bce | 18 | %endif |
19 | %if %{with python3} | |
2d23140c | 20 | BuildRequires: python3 |
21 | BuildRequires: python3-2to3 | |
22 | BuildRequires: python3-devel | |
23 | BuildRequires: python3-distribute | |
24 | BuildRequires: python3-modules | |
0cfd7bce | 25 | %endif |
2d23140c | 26 | BuildRequires: rpm-pythonprov |
5dc968a7 | 27 | %pyrequires_eq python-modules |
28 | BuildArch: noarch | |
29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
30 | ||
31 | %description | |
2d23140c | 32 | Pygments is a generic syntax highlighter for general use in all kinds |
33 | of software such as forum systems, wikis or other applications that | |
34 | need to prettify source code. Highlights are | |
5dc968a7 | 35 | - a wide range of common languages and markup formats is supported |
2d23140c | 36 | - special attention is paid to details that increase highlighting |
37 | quality | |
38 | - support for new languages and formats are added easily; most | |
39 | languages use a simple regex-based lexing mechanism | |
40 | - a number of output formats is available, among them HTML, RTF, LaTeX | |
41 | and ANSI sequences | |
5dc968a7 | 42 | - it is usable as a command-line tool and as a library |
43 | - ... and it highlights even Brainf*ck! | |
44 | ||
b039b19f AF |
45 | %package -n python3-%{module} |
46 | Summary: Generic syntax highlighter | |
47 | Group: Development/Languages/Python | |
48 | ||
49 | %description -n python3-%{module} | |
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 | |
52 | need to prettify source code. Highlights are | |
b039b19f | 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 | |
b039b19f AF |
60 | - it is usable as a command-line tool and as a library |
61 | - ... and it highlights even Brainf*ck! | |
62 | ||
5dc968a7 | 63 | %prep |
64 | %setup -q -n Pygments-%{version} | |
65 | ||
66 | %build | |
b039b19f AF |
67 | %if %{with python2} |
68 | %{__python} setup.py build -b build-2 | |
69 | %endif | |
70 | ||
71 | %if %{with python3} | |
72 | %{__python3} setup.py build -b build-3 | |
73 | %endif | |
5dc968a7 | 74 | |
75 | %install | |
76 | rm -rf $RPM_BUILD_ROOT | |
77 | ||
b039b19f AF |
78 | %if %{with python2} |
79 | %{__python} setup.py \ | |
80 | build -b build-2 \ | |
81 | install \ | |
82 | --optimize=2 \ | |
83 | --root=$RPM_BUILD_ROOT | |
84 | ||
85 | mv $RPM_BUILD_ROOT%{_bindir}/pygmentize{,-2} | |
5dc968a7 | 86 | |
87 | %py_postclean | |
b039b19f AF |
88 | %endif |
89 | ||
90 | %if %{with python3} | |
91 | %{__python3} setup.py \ | |
92 | build -b build-3 \ | |
93 | install \ | |
94 | --optimize=2 \ | |
95 | --root=$RPM_BUILD_ROOT | |
96 | ||
97 | mv $RPM_BUILD_ROOT%{_bindir}/pygmentize{,-3} | |
98 | ||
99 | %py3_postclean | |
100 | %endif | |
101 | ||
102 | ln -s pygmentize-2 $RPM_BUILD_ROOT%{_bindir}/pygmentize | |
5dc968a7 | 103 | |
104 | %clean | |
105 | rm -rf $RPM_BUILD_ROOT | |
106 | ||
b039b19f | 107 | %if %{with python2} |
5dc968a7 | 108 | %files |
109 | %defattr(644,root,root,755) | |
110 | %doc PKG-INFO TODO AUTHORS | |
b039b19f AF |
111 | %attr(755,root,root) %{_bindir}/pygmentize |
112 | %attr(755,root,root) %{_bindir}/pygmentize-2 | |
5dc968a7 | 113 | %{py_sitescriptdir}/%{module} |
c915eef2 | 114 | %{py_sitescriptdir}/*.egg-info |
b039b19f AF |
115 | %endif |
116 | ||
117 | %if %{with python3} | |
118 | %files -n python3-%{module} | |
119 | %defattr(644,root,root,755) | |
120 | %doc PKG-INFO TODO AUTHORS | |
121 | %attr(755,root,root) %{_bindir}/pygmentize-3 | |
122 | %{py3_sitescriptdir}/%{module} | |
c915eef2 | 123 | %{py3_sitescriptdir}/*.egg-info |
b039b19f | 124 | %endif |