Blob Blame History Raw
%global with_python3 1
%global pkgname factory_boy
%global desc factory_boy is a fixtures replacement based on thoughtbot's factory_girl\
<http://github.com/thoughtbot/factory_girl>.\
\
Its features include:\
\
- Straightforward syntax\
- Support for multiple build strategies (saved/unsaved instances, attribute\
  dicts, stubbed objects)\
- Powerful helpers for common cases (sequences, sub-factories, reverse\
  dependencies, circular factories, ...)\
- Multiple factories per class support, including inheritance\
- Support for various ORMs (currently Django, Mogo, SQLAlchemy)\

Name:           python-factory-boy
Version:        2.7.0
Release:        3%{?dist}
Summary:        A versatile test fixtures replacement based on thoughtbot's factory_girl

Group:          Development/Languages
License:        MIT
URL:            https://github.com/rbarrois/factory_boy
Source0:        https://github.com/rbarrois/factory_boy/archive/v%{version}.tar.gz
BuildArch:      noarch
BuildRequires:  python2-devel 
BuildRequires:  python-setuptools
BuildRequires:  python-sphinx
BuildRequires:  python-sphinx_rtd_theme
BuildRequires:  python-mock
BuildRequires:  python-django
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%endif

%description
%desc

%package -n python2-factory-boy
Summary:        A versatile test fixtures replacement based on thoughtbot's factory_girl
Group:          Development/Languages
Requires:       python-faker
%{?python_provide:%python_provide python2-factory-boy}
Suggests:       %{name}-doc = %{version}-%{release}

%description -n python2-factory-boy
%desc

%if 0%{?with_python3}
%package -n python3-factory-boy
Summary:        A versatile test fixtures replacement based on thoughtbot's factory_girl
Group:          Development/Languages
Requires:       python3-faker
%{?python_provide:%python_provide python3-factory-boy}
Suggests:       %{name}-doc = %{version}-%{release}

%description -n python3-factory-boy
%desc

%endif

%package doc
Group: Documentation
Summary: API documentation for %{name}

%description doc
Documentation for the %{name} API

%prep
%autosetup -n %{pkgname}-%{version}
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%py2_build
%if 0%{?with_python3}
pushd %{py3dir}
%py3_build
popd
%endif

# Build the docs
pushd docs
%make_build html
%make_build text
%make_build man
find . -name .buildinfo -print0 | xargs -0 rm -f
sed -i 's/\r$//' _build/html/_static/jquery.js
popd

%install
%py2_install
%if 0%{?with_python3}
pushd %{py3dir}
%py3_install
popd
%endif
install -D -m 644 docs/_build/man/factoryboy.1 %{buildroot}%{_mandir}/man3/factoryboy.3

%check
# Checks disabled because they download packages from the Internet
#%%{__python2} setup.py test
#%%if 0%%{?with_python3}
#pushd %%{py3dir}
#%%{__python3} setup.py test
#popd
#%%endif

%files -n python2-factory-boy
%doc README.rst
%{python2_sitelib}/factory
%{python2_sitelib}/%{pkgname}-%{version}-py*.egg-info

%if 0%{?with_python3}
%files -n python3-factory-boy
%doc README.rst
%{python3_sitelib}/factory
%{python3_sitelib}/%{pkgname}-%{version}-py*.egg-info
%endif

%files doc
%doc README.rst
%doc docs/_build/html
%doc docs/_build/text
%{_mandir}/man3/factoryboy.3*

%changelog
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.0-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Wed Jul 06 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 2.7.0-2
- Add BuildRequires: python-sphinx_rtd_theme

* Thu Jun 23 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 2.7.0-1
- Version 2.7.0

* Wed Feb 24 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 2.6.1-1
- Version 2.6.1

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sat Nov 14 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 2.6.0-3
- Add python-faker dependency
- Use python_provide macro

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Wed Oct 21 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 2.6.0-1
- New version 2.6.0

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue Dec 23 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 2.5.2-1
- New version 2.5.2

* Tue Dec 23 2014 Juan Orti <jorti@fedoraproject.org> - 2.4.1-4
- Use parallel make

* Mon Dec 15 2014 Juan Orti <jorti@fedoraproject.org> - 2.4.1-3
- Update to commit 392db861e585f12038f18f41e467ecfcab9d39b0
- Drop patch factory_boy-2.4.1-disable_broken_tests.patch

* Wed Dec 10 2014 Juan Orti <jorti@fedoraproject.org> - 2.4.1-2
- Rename python3 subpackage to python3-factory-boy
- Move manpage to doc subpackage and to section 3
- Fit summary and description in 80 characters width lines
- Remove .buildinfo files
- Run tests
- Add patch to disable broken tests
- Change Source0 to GitHub
- Add documentation in plain text format

* Wed Dec 03 2014 Juan Orti <jorti@fedoraproject.org> - 2.4.1-1
- Update to version 2.4.1
- Spec file cleanup

* Sat May 24 2014 Didier Fabert <didier.fabert@gmail.com> 2.3.1-1
- Initial RPM release