#2 EPEL 7: run tests, add Python 3 subpackage
Merged 3 years ago by fschwarz. Opened 4 years ago by fschwarz.
Unknown source epel7  into  epel7

file modified
+28 -57
@@ -1,12 +1,12 @@

- %if 0%{?fedora} > 12

- %global with_python3 1

- %endif

  

  %global pypi_name fasteners

+ %global py3_prefix python%{python3_pkgversion}

+ 

+ %bcond_with py3_tests

  

  Name:           python-%{pypi_name}

  Version:        0.9.0

- Release:        2%{?dist}

+ Release:        3%{?dist}

  Summary:        A python package that provides useful locks

  

  License:        ASL 2.0
@@ -15,85 +15,55 @@

  BuildArch:      noarch

  

  BuildRequires:  python2-devel

- 

  BuildRequires:  python-six

  Requires:       python-six

  

  # tests:

- BuildRequires:  python-testtools

+ BuildRequires:  python-futures

  BuildRequires:  python-nose

+ BuildRequires:  python-testtools

  

- %if 0%{?with_python3}

- %package -n python3-%{pypi_name}

- Summary:        A python package that provides useful locks

  

- BuildRequires:  python3-six

- BuildRequires:  python3-devel

+ %package -n %{py3_prefix}-%{pypi_name}

+ Summary:        A python package that provides useful locks

  

+ BuildRequires:  %{py3_prefix}-devel

+ %if %{with py3_tests}

  # tests

- BuildRequires:  python3-testtools

- BuildRequires:  python3-nose

+ BuildRequires:  %{py3_prefix}-nose

+ BuildRequires:  %{py3_prefix}-six

+ BuildRequires:  %{py3_prefix}-testtools

+ %endif

  

- Requires:  python3-six

+ Requires:       %{py3_prefix}-six

  

- %description -n python3-%{pypi_name}

+ %description -n %{py3_prefix}-%{pypi_name}

  A python package that provides useful locks.

  

  

- %endif

- 

- 

  %description

  A python package that provides useful locks.

  

  

  %prep

- %setup -qc

- mv %{pypi_name}-%{version} python2

- pushd python2

- 

- # copy LICENSE etc. to top level dir

- cp -a LICENSE ..

- cp -a README.rst ..

- 

+ %autosetup -p1 -n %{pypi_name}-%{version}

  # Remove bundled egg-info

  rm -rf %{pypi_name}.egg-info

  

- popd

- 

- %if 0%{?with_python3}

- cp -a python2 python3

- %endif

- 

- 

  %build

- pushd python2

- %{__python2} setup.py build

- popd

- 

- %if 0%{?with_python3}

- pushd python3

- %{__python3} setup.py build

- popd

- %endif # with_python3

+ %py2_build

+ %py3_build

  

  %install

- pushd python2

- %{__python2} setup.py install --skip-build --root %{buildroot}

- popd

- 

- %if 0%{?with_python3}

- pushd python3

- %{__python3} setup.py install --skip-build --root %{buildroot}

- popd

- %endif # with_python3

+ %py2_install

+ %py3_install

  

  %check

  nosetests-2.7

+ %if %{with py3_tests}

+ nosetests-%{python3_version}

+ %endif

  

- %if 0%{?with_python3}

- nosetests-3.4

- %endif # with_python3

  

  %files

  %doc README.rst
@@ -101,16 +71,17 @@

  %{python2_sitelib}/%{pypi_name}

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

  

- %if 0%{?with_python3}

- %files -n python3-%{pypi_name}

+ %files -n %{py3_prefix}-%{pypi_name}

  %doc README.rst

  %license LICENSE

  %{python3_sitelib}/%{pypi_name}

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

- %endif # with_python3

  

  

  %changelog

+ * Mon Apr 13 2020 Felix Schwarz <fschwarz@fedoraproject.org> - 0.9.0-3

+ - add Python 3 subpackage

+ 

  * Fri Jun 12 2015 Matthias Runge <mrunge@redhat.com> - 0.9.0-2

  - switch to github sourcecode, license included

  - add tests, fix conditionals for python3

This pr adds a Python 3 subpackage (rhbz #1823122). While I was working on this I noticed that no unittests were run in %check. I fixed that as well.

This PR requires python36-testtools which is not yet available in EPEL 7. I submitted a pull request for that as well: https://src.fedoraproject.org/rpms/python-testtools/pull-request/7

Thank you for your PR!

This copy python2/python3 thing is something, which should have been removed a while ago, when %py3_build and %py2_build started to work on the same source tree.

The scratch-build fails due to "No matching package to install: 'python36-testtools'"

The scratch-build fails due to "No matching package to install: 'python36-testtools'"

Yes, that is expected because testtools PR 7 is not yet merged. I can add %bcond_without py3_tests so the package can built built even without python36-testtools.

2 new commits added

  • remove unnecessary pushd/pop
  • add "%bcond_with py3_tests" so the package can be built even though python36-testtools is not yet avaiable in EPEL7
4 years ago

I added two commits so there is no python2/python3 copy anymore and you can build the package in EPEL 7 even without python36-testtools (no tests run for Python 3 in that case, ease to switch the flag once python36-testtools is available.

5 new commits added

  • remove unnecessary pushd/pop
  • add "%bcond_with py3_tests" so the package can be built even though python36-testtools is not yet avaiable in EPEL7
  • add Python 3 subpackage
  • fix test execution in %check
  • use modern macros
3 years ago

I found an glaring mistake in the python 3 subpackage which I fixed now (I used the "python3-" prefix instead of "python36-").

python36-testtools is now available in EPEL 7 testing so rebuilding should be simple (with a buildroot override).

ping?

I believe the change could be merged+built for epel now because python36-testtools is available.

Thank you for the reminder. You can do int yourself now, I believe. I also made you the primary contact for epel bugs.

Ok, will do.

I didn't want to just push my changes to a package I never touched before :-)

Pull-Request has been merged by fschwarz

3 years ago