#3 Remove python2 subpackages in fedora
Opened 5 years ago by amoralej. Modified 5 years ago
rpms/ amoralej/python-yaql master  into  rawhide

file modified
+36 -12
@@ -7,10 +7,17 @@ 

  %{!?python3_shortver: %global python3_shortver %(%{__python3} -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')}

  %endif

  

+ %if 0%{?fedora} || 0%{?rhel} > 7

+ %bcond_with    python2

+ %bcond_without python3

+ %else

+ %bcond_without python2

+ %bcond_with    python3

+ %endif

  

  Name:           python-%{pypi_name}

  Version:        1.1.3

- Release:        6%{?dist}

+ Release:        7%{?dist}

  Summary:        Yet Another Query Language

  

  License:        ASL 2.0
@@ -22,6 +29,7 @@ 

  %description

  YAQL library has a out of the box large set of commonly used functions.

  

+ %if %{with python2}

  %package -n     python2-%{pypi_name}

  Summary:        YAQL library has a out of the box large set of commonly used functions.

  %{?python_provide:%python_provide python2-%{pypi_name}}
@@ -44,10 +52,10 @@ 

  

  %description -n python2-%{pypi_name}

  YAQL library has a out of the box large set of commonly used functions

- 

+ %endif

  

  # Python3 package

- %if 0%{?with_python3}

+ %if %{with python3}

  %package -n     python3-%{pypi_name}

  Summary:        YAQL library has a out of the box large set of commonly used functions.

  %{?python_provide:%python_provide python3-%{pypi_name}}
@@ -84,51 +92,63 @@ 

  # Let RPM handle the dependencies

  rm -f test-requirements.txt requirements.txt

  

- %if 0%{?with_python3}

+ %if %{with python3}

  rm -rf %{py3dir}

  cp -a . %{py3dir}

  2to3 --write --nobackups %{py3dir}

  %endif

  

  %build

+ %if %{with python2}

  %py2_build

- %if 0%{?with_python3}

+ %endif

+ %if %{with python3}

  pushd %{py3dir}

  %py3_build

  popd

  %endif

  # generate html docs 

+ %if %{with python2}

  sphinx-build doc/source html

+ %else

+ sphinx-build-3 doc/source html

+ %endif

  # remove the sphinx-build leftovers

  rm -rf html/.{doctrees,buildinfo}

  

  %install

- %if 0%{?with_python3}

+ %if %{with python3}

  pushd %{py3dir}

  %py3_install

- mv %{buildroot}/%{_bindir}/%{pypi_name} %{buildroot}/%{_bindir}/python3-%{pypi_name}

  popd

  %endif

  

+ %if %{with python2}

  %py2_install

+ %endif

  

  # rename binaries, make compat symlinks

+ %if %{with python2}

  pushd %{buildroot}%{_bindir}

  for i in %{pypi_name}-{2,%{?python2_shortver}}; do

      ln -sf %{pypi_name} $i

  done

+ popd

+ %endif

  

- %if 0%{?with_python3}

+ %if %{with python3}

+ pushd %{buildroot}%{_bindir}

  for i in %{pypi_name}-{3,%{?python3_shortver}}; do

-     ln -sf  python3-%{pypi_name} $i

+     ln -sf  %{pypi_name} $i

  done

- %endif

  popd

+ %endif

  

  # Delete tests

  rm -fr %{buildroot}%{python_sitelib}/tests

  

   

+ %if %{with python2}

  %files -n python2-%{pypi_name}

  %license LICENSE

  %doc doc/source/readme.rst README.rst
@@ -136,14 +156,15 @@ 

  %{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

  %{_bindir}/%{pypi_name}-2*

  %{_bindir}/%{pypi_name}

+ %endif

  

  # Files for python3

- %if 0%{?with_python3}

+ %if %{with python3}

  %files -n python3-%{pypi_name} 

  %license LICENSE

  %doc doc/source/readme.rst README.rst

- %{_bindir}/python3-%{pypi_name}

  %{_bindir}/%{pypi_name}-3*

+ %{_bindir}/%{pypi_name}

  %{python3_sitelib}/%{pypi_name}

  %{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

  %endif
@@ -154,6 +175,9 @@ 

  

  

  %changelog

+ * Tue Feb 26 2019 Alfredo Moralejo <amoralej@redhat.com> - 1.1.3-7

+ - Remove python2 subpackages in fedora.

+ 

  * Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.3-6

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

  

no initial comment