python-pygments-vl.spec 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. %{!?__python3:%global __python3 /usr/bin/python3}
  2. %{!?python3_inc:%global python3_inc %(%{__python3} -c "from distutils.sysconfig import get_python_inc; print(get_python_inc(1))")}
  3. %{!?python3_sitearch: %global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")}
  4. %{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
  5. %{!?python3_version: %global python3_version %(python3 -c "import sys; sys.stdout.write(sys.version[:3])")}
  6. %{!?__python2: %global __python2 /usr/bin/python2}
  7. %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
  8. %define py2_setup setup.py
  9. %define py2_shbang_opts -s
  10. %define py2_build() %{expand:\
  11. CFLAGS="%{optflags}" %{__python2} %{py2_setup} %{?py2_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?1}\
  12. }
  13. %define py2_install() %{expand:\
  14. CFLAGS="%{optflags}" %{__python2} %{py2_setup} %{?py2_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
  15. }
  16. %define py3_setup setup.py
  17. %define py3_shbang_opts -s
  18. %define py3_build() %{expand:\
  19. CFLAGS="%{optflags}" %{__python3} %{py3_setup} %{?py3_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?1}\
  20. }
  21. %define py3_install() %{expand:\
  22. CFLAGS="%{optflags}" %{__python3} %{py3_setup} %{?py3_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
  23. }
  24. %define py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
  25. %global with_python3 1
  26. %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
  27. %global upstream_name Pygments
  28. Name: python-pygments
  29. Version: 2.1.3
  30. Release: 1%{?_dist_release}
  31. Summary: A syntax highlighting engine written in Python
  32. Group: Development/Libraries
  33. License: BSD
  34. URL: http://pygments.org/
  35. Source0: http://pypi.python.org/packages/source/P/%{upstream_name}/%{upstream_name}-%{version}.tar.gz
  36. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  37. BuildArch: noarch
  38. BuildRequires: python-devel >= 2.4, python-setuptools, python-nose
  39. %if 0%{?with_python3}
  40. BuildRequires: python3-devel, python3-setuptools
  41. %endif # if with_python3
  42. Requires: python-setuptools, python-imaging
  43. Vendor: Project Vine
  44. Distribution: Vine Linux
  45. %description
  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
  48. need to prettify source code. Highlights are:
  49. * a wide range of common languages and markup formats is supported
  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,
  55. LaTeX and ANSI sequences
  56. * it is usable as a command-line tool and as a library
  57. * ... and it highlights even Brainf*ck!
  58. %if 0%{?with_python3}
  59. %package -n python3-pygments
  60. Summary: A syntax highlighting engine written in Python 3
  61. Group: Development/Libraries
  62. Requires: python3-setuptools
  63. %description -n python3-pygments
  64. Pygments is a generic syntax highlighter for general use in all kinds
  65. of software such as forum systems, wikis or other applications that
  66. need to prettify source code. Highlights are:
  67. * a wide range of common languages and markup formats is supported
  68. * special attention is paid to details that increase highlighting
  69. quality
  70. * support for new languages and formats are added easily; most
  71. languages use a simple regex-based lexing mechanism
  72. * a number of output formats is available, among them HTML, RTF,
  73. LaTeX and ANSI sequences
  74. * it is usable as a command-line tool and as a library
  75. * ... and it highlights even Brainf*ck!
  76. %endif # if with_python3
  77. %prep
  78. %setup -q -n Pygments-%{version}
  79. %if 0%{?with_python3}
  80. %__rm -rf %{py3dir}
  81. %__cp -a . %{py3dir}
  82. find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
  83. %endif # with_python3
  84. %build
  85. %{__python} setup.py build
  86. %{__sed} -i 's/\r//' LICENSE
  87. %if 0%{?with_python3}
  88. pushd %{py3dir}
  89. %{__python3} setup.py build
  90. popd
  91. %endif # with_python3
  92. %install
  93. %__rm -rf $RPM_BUILD_ROOT
  94. # Run the Python 3 build first so that the Python 2 version of
  95. # /usr/bin/pygmentize "wins":
  96. %if 0%{?with_python3}
  97. pushd %{py3dir}
  98. %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
  99. popd
  100. %endif # with_python3
  101. %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
  102. pushd doc
  103. %__install -d %{buildroot}%{_mandir}/man1
  104. %__mv pygmentize.1 $RPM_BUILD_ROOT%{_mandir}/man1/pygmentize.1
  105. popd
  106. cp -r doc/docs doc/reST
  107. %clean
  108. %__rm -rf $RPM_BUILD_ROOT
  109. %check
  110. %__make test
  111. # nose is not Python3 ready yet
  112. %if 0%{?with_python3}
  113. pushd %{py3dir}
  114. make test
  115. popd
  116. %endif # with_python3
  117. %files
  118. %defattr(-,root,root,-)
  119. %license LICENSE
  120. %doc AUTHORS CHANGES doc/reST TODO
  121. # For noarch packages: sitelib
  122. %{python_sitelib}/*
  123. %{_bindir}/pygmentize
  124. %lang(en) %{_mandir}/man1/pygmentize.1.gz
  125. %if 0%{?with_python3}
  126. %files -n python3-pygments
  127. %defattr(-,root,root,-)
  128. %license LICENSE
  129. %doc AUTHORS CHANGES doc/reST TODO
  130. %{python3_sitelib}/*
  131. %endif # with_python3
  132. %changelog
  133. * Tue Jul 12 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 2.1.3-1
  134. - new upstream release.
  135. * Sun Jan 12 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.3.1-3
  136. - rebuild with VineSeed environment
  137. * Sun Feb 19 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.3.1-2
  138. - rebuild with python-2.7.2
  139. * Mon Aug 23 2010 Munehiro Yamamoto <munepi@vinelinux.org> - 1.3.1-1
  140. - initial build based on Fedora development
  141. * Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 1.3.1-6
  142. - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
  143. * Thu May 6 2010 Gareth Armstrong <gareth.armstrong@hp.com> - 1.3.1-5
  144. - Enforce that Pygments requires Python 2.4 or later via an explicit BR
  145. - Minor tweaks to spec file
  146. - Deliver html and reST doc files to specifically named directories
  147. - Align description with that of http://pygments.org/
  148. - Add %%check section for Python2 and add BR on python-nose
  149. * Fri Apr 23 2010 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.3.1-4
  150. - switched with_python3 back to 1
  151. * Fri Apr 23 2010 David Malcolm <dmalcolm@redhat.com> - 1.3.1-3
  152. - add python3 subpackage (BZ#537244), ignoring soft-dep on imaging for now
  153. * Tue Apr 13 2010 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.3.1-2
  154. - added python-imaging as a dependency per BZ#581663.
  155. * Sat Mar 6 2010 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.3.1-1
  156. - Updated for release.
  157. * Tue Sep 29 2009 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.1.1-1
  158. - Updated for release.
  159. * Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-5
  160. - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
  161. * Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-4
  162. - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
  163. * Sun Dec 21 2008 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.0-3
  164. - Updated for release.
  165. * Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 1.0-2
  166. - Rebuild for Python 2.6
  167. * Thu Nov 27 2008 Steve 'Ashcrow' Milner <me@stevemilner.org> - 1.0-1
  168. - Updated for upstream 1.0.
  169. * Sun Sep 14 2008 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.11.1-1
  170. - Updated for upstream 0.11.
  171. * Mon Jul 21 2008 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.10-1
  172. - Updated for upstream 0.10.
  173. * Thu Nov 29 2007 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.9-2
  174. - Added python-setuptools as a Requires per bz#403601.
  175. * Mon Nov 12 2007 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.9-1
  176. - Updated for upstream 0.9.
  177. * Fri Aug 17 2007 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.8.1-2
  178. - Removed the dos2unix build dependency.
  179. * Thu Jun 28 2007 Steve 'Ashcrow' Milner <me@stevemilner.org> - 0.8.1-1
  180. - Initial packaging for Fedora.