Browse Source

python-pygments-2.3.0-1

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@11925 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop 5 years ago
parent
commit
857e59dfdf
1 changed files with 34 additions and 68 deletions
  1. 34 68
      p/python-pygments/python-pygments-vl.spec

+ 34 - 68
p/python-pygments/python-pygments-vl.spec

@@ -1,36 +1,9 @@
-%{!?__python3:%global __python3 /usr/bin/python3}
-%{!?python3_inc:%global python3_inc %(%{__python3} -c "from distutils.sysconfig import get_python_inc; print(get_python_inc(1))")}
-%{!?python3_sitearch: %global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")}
-%{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
-%{!?python3_version: %global python3_version %(python3 -c "import sys; sys.stdout.write(sys.version[:3])")}
-%{!?__python2: %global __python2 /usr/bin/python2}
-%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
-%define py2_setup setup.py
-%define py2_shbang_opts -s
-%define py2_build() %{expand:\
- CFLAGS="%{optflags}" %{__python2} %{py2_setup} %{?py2_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?1}\
-}
-%define py2_install() %{expand:\
- CFLAGS="%{optflags}" %{__python2} %{py2_setup} %{?py2_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
-}
-%define py3_setup setup.py
-%define py3_shbang_opts -s
-%define py3_build() %{expand:\
- CFLAGS="%{optflags}" %{__python3} %{py3_setup} %{?py3_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?1}\
-}
-%define py3_install() %{expand:\
- CFLAGS="%{optflags}" %{__python3} %{py3_setup} %{?py3_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
-}
-%define py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
-
-
 %global with_python3 1
-
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
 %global upstream_name Pygments
+%global srcname pygments
 
 Name:           python-pygments
-Version:        2.1.3
+Version:        2.3.0
 Release:        1%{?_dist_release}
 Summary:        A syntax highlighting engine written in Python
 
@@ -38,14 +11,18 @@ Group:          Development/Libraries
 License:        BSD
 URL:            http://pygments.org/
 Source0:        http://pypi.python.org/packages/source/P/%{upstream_name}/%{upstream_name}-%{version}.tar.gz
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:      noarch
 BuildRequires:  python-devel >= 2.4, python-setuptools, python-nose
+BuildRequires:  python-sphinx
+BuildRequires:  python-rpm-macros
 %if 0%{?with_python3}
-BuildRequires:  python3-devel, python3-setuptools
+BuildRequires:  python3-devel, python3-setuptools, python3-nose
+BuildRequires:  python3-rpm-macros
 %endif # if with_python3
-Requires:       python-setuptools, python-imaging
+Requires:       python-setuptools
 
 Vendor: Project Vine
 Distribution: Vine Linux
@@ -89,79 +66,68 @@ need to prettify source code. Highlights are:
 
 
 %prep
-%setup -q -n Pygments-%{version}
-
-%if 0%{?with_python3}
-%__rm -rf %{py3dir}
-%__cp -a . %{py3dir}
-find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
-%endif # with_python3
-
+%setup -q -n %{upstream_name}-%{version}
 
 %build
-%{__python} setup.py build
 %{__sed} -i 's/\r//' LICENSE
+%py_build
 
 %if 0%{?with_python3}
-pushd %{py3dir}
-%{__python3} setup.py build
-popd
-%endif # with_python3
-
+%py3_build
+%endif
 
 %install
 %__rm -rf $RPM_BUILD_ROOT
 
-# Run the Python 3 build first so that the Python 2 version of
-# /usr/bin/pygmentize "wins":
-%if 0%{?with_python3}
-pushd %{py3dir}
-%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
-popd
-%endif # with_python3
-
-%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+# Python 2 install
+# NOTE: sphinx is built on Python2 and packages with python2 and python3
+%py_install
+%{__python} setup.py build_sphinx
 pushd doc
-%__install -d %{buildroot}%{_mandir}/man1
-%__mv pygmentize.1 $RPM_BUILD_ROOT%{_mandir}/man1/pygmentize.1
+install -d %{buildroot}%{_mandir}/man1
+mv pygmentize.1 $RPM_BUILD_ROOT%{_mandir}/man1/pygmentize.1
 popd
 cp -r doc/docs doc/reST
 
+%if 0%{?with_python3}
+# Python 3 install
+%py3_install
+%endif
 
 %clean
 %__rm -rf $RPM_BUILD_ROOT
 
-
 %check
-%__make test
-
-# nose is not Python3 ready yet
+make test PYTHON=%{__python}
 %if 0%{?with_python3}
-pushd %{py3dir}
-make test
-popd
-%endif # with_python3
-
+make test PYTHON=%{__python3}
+%endif
 
 %files
 %defattr(-,root,root,-)
+%doc AUTHORS CHANGES build/sphinx/html doc/reST TODO
 %license LICENSE
-%doc AUTHORS CHANGES doc/reST TODO
 # For noarch packages: sitelib
 %{python_sitelib}/*
 %{_bindir}/pygmentize
-%lang(en) %{_mandir}/man1/pygmentize.1.gz
+%lang(en) %{_mandir}/man1/pygmentize.1*
 
 %if 0%{?with_python3}
 %files -n python3-pygments
 %defattr(-,root,root,-)
+%doc AUTHORS CHANGES build/sphinx/html doc/reST TODO
 %license LICENSE
-%doc AUTHORS CHANGES doc/reST TODO
 %{python3_sitelib}/*
+#{_bindir}/pygmentize
+#lang(en) %{_mandir}/man1/pygmentize.1*
 %endif # with_python3
 
 
 %changelog
+* Tue Nov 27 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 2.3.0-1
+- new upstream release.
+- added python3 support.
+
 * Tue Jul 12 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 2.1.3-1
 - new upstream release.