Modernize spec

- Run python2 tests, python3 failing
This commit is contained in:
Orion Poplawski 2016-01-08 12:10:39 -07:00
parent ba9c8191ac
commit 4df2257b10

View File

@ -1,7 +1,10 @@
%if 0%{?fedora} > 12 || 0%{?rhel} > 6 %if 0%{?fedora} || 0%{?rhel} > 6
%global with_python3 1 %global with_python3 1
%endif %endif
# Not yet in Fedora buildroot
%{!?python3_pkgversion:%global python3_pkgversion 3}
%global mod_name mock %global mod_name mock
Name: python-mock Name: python-mock
@ -9,7 +12,6 @@ Version: 1.0.1
Release: 8%{?dist} Release: 8%{?dist}
Summary: A Python Mocking and Patching Library for Testing Summary: A Python Mocking and Patching Library for Testing
Group: Development/Libraries
License: BSD License: BSD
URL: http://www.voidspace.org.uk/python/%{mod_name}/ URL: http://www.voidspace.org.uk/python/%{mod_name}/
Source0: http://pypi.python.org/packages/source/m/%{mod_name}/%{mod_name}-%{version}.tar.gz Source0: http://pypi.python.org/packages/source/m/%{mod_name}/%{mod_name}-%{version}.tar.gz
@ -18,13 +20,16 @@ Source1: LICENSE.txt
BuildArch: noarch BuildArch: noarch
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python-setuptools BuildRequires: python-setuptools
%if 0%{?rhel} <= 6 # For tests
%if 0%{?rhel} <= 7
BuildRequires: python-unittest2 BuildRequires: python-unittest2
%endif %endif
%if 0%{?with_python3} %if 0%{?with_python3}
BuildRequires: python3-devel BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python3-setuptools BuildRequires: python%{python3_pkgversion}-setuptools
# For tests
#BuildRequires: python%{python3_pkgversion}-unittest2
%endif %endif
@ -35,18 +40,27 @@ action, you can make assertions about which methods / attributes were used and
arguments they were called with. You can also specify return values and set arguments they were called with. You can also specify return values and set
needed attributes in the normal way. needed attributes in the normal way.
%if 0%{?with_python3} %package -n python2-mock
%package -n python3-mock
Summary: A Python Mocking and Patching Library for Testing Summary: A Python Mocking and Patching Library for Testing
Group: Development/Libraries %{?python_provide:%python_provide python2-%{mod_name}}
%description -n python3-mock %description -n python2-mock
Mock is a Python module that provides a core mock class. It removes the need
to create a host of stubs throughout your test suite. After performing an
action, you can make assertions about which methods / attributes were used and
arguments they were called with. You can also specify return values and set
%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-mock
Summary: A Python Mocking and Patching Library for Testing
%{?python_provide:%python_provide python%{python3_pkgversion}-%{mod_name}}
%description -n python%{python3_pkgversion}-mock
Mock is a Python module that provides a core mock class. It removes the need Mock is a Python module that provides a core mock class. It removes the need
to create a host of stubs throughout your test suite. After performing an to create a host of stubs throughout your test suite. After performing an
action, you can make assertions about which methods / attributes were used and action, you can make assertions about which methods / attributes were used and
arguments they were called with. You can also specify return values and set arguments they were called with. You can also specify return values and set
needed attributes in the normal way. needed attributes in the normal way.
%endif %endif
@ -54,45 +68,33 @@ needed attributes in the normal way.
%setup -q -n %{mod_name}-%{version} %setup -q -n %{mod_name}-%{version}
cp -p %{SOURCE1} . cp -p %{SOURCE1} .
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -ap . %{py3dir}
%endif
%build %build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build %{py2_build}
%{py3_build}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
#check %check
#{__python} setup.py test %{__python2} setup.py test
# Failing
#{__python3} setup.py test
%install %install
rm -rf $RPM_BUILD_ROOT %{py3_install}
%if 0%{?with_python3} %{py2_install}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
popd
%endif
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%files %files -n python2-mock
%doc docs/ README.txt PKG-INFO LICENSE.txt %license LICENSE.txt
%{python_sitelib}/*.egg-info %doc docs/* README.txt PKG-INFO
%{python_sitelib}/%{mod_name}.py* %{python2_sitelib}/*.egg-info
%{python2_sitelib}/%{mod_name}.py*
%if 0%{?with_python3} %if 0%{?with_python3}
%files -n python3-mock %files -n python%{python3_pkgversion}-mock
%doc docs/ README.txt PKG-INFO LICENSE.txt %license LICENSE.txt
%doc docs/* README.txt PKG-INFO
%{python3_sitelib}/*.egg-info %{python3_sitelib}/*.egg-info
%{python3_sitelib}/%{mod_name}.py* %{python3_sitelib}/%{mod_name}.py*
%{python3_sitelib}/__pycache__/%{mod_name}* %{python3_sitelib}/__pycache__/%{mod_name}*
@ -100,6 +102,10 @@ popd
%changelog %changelog
* Wed Jan 6 2016 Orion Poplawski <orion@cora.nwra.com> - 1.0.1-9
- Modernize spec
- Run python2 tests, python3 failing
* Thu Nov 12 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-8 * Thu Nov 12 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-8
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 - Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5