Python3 support.

Signed-off-by: Praveen Kumar <daredevil@pkumar222.asiapacific.hpqcorp.net>
This commit is contained in:
Ralph Bean 2012-07-09 15:58:42 -04:00 committed by Praveen Kumar
parent 6d73369908
commit fc7ae9436d

View File

@ -1,8 +1,12 @@
%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%global with_python3 1
%endif
%global mod_name mock %global mod_name mock
Name: python-mock Name: python-mock
Version: 0.8.0 Version: 0.8.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: A Python Mocking and Patching Library for Testing Summary: A Python Mocking and Patching Library for Testing
Group: Development/Libraries Group: Development/Libraries
@ -14,6 +18,11 @@ Source1: LICENSE.txt
BuildArch: noarch BuildArch: noarch
BuildRequires: python-devel BuildRequires: python-devel
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif
%description %description
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
@ -21,17 +30,49 @@ 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 python3-mock
Summary: A Python Mocking and Patching Library for Testing
Group: Development/Libraries
%description -n python3-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
needed attributes in the normal way.
%endif
%prep %prep
%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 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%if 0%{?with_python3}
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 %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
@ -40,8 +81,19 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitelib}/*.egg-info %{python_sitelib}/*.egg-info
%{python_sitelib}/%{mod_name}.py* %{python_sitelib}/%{mod_name}.py*
%if 0%{?with_python3}
%files -n python3-mock
%doc docs/ README.txt PKG-INFO LICENSE.txt
%{python3_sitelib}/*.egg-info
%{python3_sitelib}/%{mod_name}.py*
%{python3_sitelib}/__pycache__/%{mod_name}*
%endif
%changelog %changelog
* Mon Jul 09 2012 Ralph Bean <rbean@redhat.com> - 0.8.0-2
- Python3 support
* Thu Mar 22 2012 Praveen Kumar <kumarpraveen.nitdgp@gmail.com> - 0.8.0-1 * Thu Mar 22 2012 Praveen Kumar <kumarpraveen.nitdgp@gmail.com> - 0.8.0-1
- Updated to new version - Updated to new version