File python-fake-factory.spec of Package python-fake-factory

%if 0%{?fedora} >= 22
%global with_python3 1
%endif

%global unmangled_name fake-factory
%global github_name faker
%global github_user joke2k

Summary: Faker is a Python package that generates fake data for you.
Name: python-%{unmangled_name}
Version: 0.5.3
Release: 1%{?dist}
Source0: https://github.com/%{github_user}/%{github_name}/archive/v%{version}/%{github_name}-%{version}.tar.gz
Patch0: python-fake-factory-test-loader.patch
License: MIT
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: joke2k <joke2k@gmail.com>
Url: http://github.com/joke2k/faker
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-mock
BuildRequires: python-UkPostcodeParser
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-mock
BuildRequires: python3-UkPostcodeParser
%endif

%description
Faker is a Python package that generates fake data for you. Whether
you need to bootstrap your database, create good-looking XML documents,
fill-in your persistence to stress test it, or anonymize data taken from
a production service, Faker is for you.

Faker is heavily inspired by PHP Faker, Perl Faker, and by Ruby Faker.

%package -n python2-%{unmangled_name}
Summary: Faker is a Python package that generates fake data for you.
Group: Development/Libraries
%{?python_provide:%python_provide python2-%{unmangled_name}}

%description -n python2-%{unmangled_name}
Faker is a Python package that generates fake data for you. Whether
you need to bootstrap your database, create good-looking XML documents,
fill-in your persistence to stress test it, or anonymize data taken from
a production service, Faker is for you.

Faker is heavily inspired by PHP Faker, Perl Faker, and by Ruby Faker.

This package contains the python2 version of this module.

%if 0%{?with_python3}
%package -n python3-%{unmangled_name}
Summary: Faker is a Python package that generates fake data for you.
Group: Development/Libraries
%{?python_provide:%python_provide python3-%{unmangled_name}}

%description -n python3-%{unmangled_name}
Faker is a Python package that generates fake data for you. Whether
you need to bootstrap your database, create good-looking XML documents,
fill-in your persistence to stress test it, or anonymize data taken from
a production service, Faker is for you.

Faker is heavily inspired by PHP Faker, Perl Faker, and by Ruby Faker.

This package contains the python3 version of this module.
%endif

%prep
%setup -n %{github_name}-%{version}
%patch0 -p1

%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif

%install
%if 0%{?with_python3}
%py3_install
%endif
%py2_install

%check
%{__python2} %{py_setup} test

%if 0%{?with_python3}
%{__python3} %{py_setup} test
%endif

%files -n python2-%{unmangled_name}
%license LICENSE.txt
%doc *.rst
%{python2_sitelib}/faker
%{python2_sitelib}/fake_factory-%{version}-py?.?.egg-info
%{_bindir}/*

%if 0%{?with_python3}
%files -n python3-%{unmangled_name}
%license LICENSE.txt
%doc *.rst
%{python3_sitelib}/faker
%{python3_sitelib}/fake_factory-%{version}-py?.?.egg-info
%endif