File python-Faker.spec of Package python-Faker

#
# spec file for package python-Faker
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
%bcond_with     test
Name:           python-Faker
Version:        0.8.10
Release:        0
Summary:        Faker is a Python package that generates fake data
License:        MIT
Group:          Development/Languages/Python
Url:            https://github.com/joke2k/faker
Source:         https://files.pythonhosted.org/packages/source/F/Faker/Faker-%{version}.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  python-rpm-macros
%if %{with test}
BuildRequires:  %{python_module email_validator >= 1.0.2}
BuildRequires:  %{python_module mock}
BuildRequires:  %{python_module python-dateutil >= 2.4}
BuildRequires:  %{python_module six}
BuildRequires:  %{python_module text-unidecode}
BuildRequires:  python-ipaddress
%endif
BuildRequires:  fdupes
Requires:       python-email_validator >= 1.0.2
Requires:       python-python-dateutil >= 2.4
Requires:       python-six
Requires:       python-text-unidecode
%ifpython2
Recommends:     python-ipaddress
Obsoletes:      %{oldpython}-fake-factory < %{version}
Provides:       %{oldpython}-fake-factory = %{version}
%endif
%ifpython3
Obsoletes:      python3-fake-factory < %{version}
Provides:       python3-fake-factory = %{version}
%endif
Requires(post):   update-alternatives
Requires(postun):  update-alternatives
BuildArch:      noarch

%python_subpackages

%description
Faker is a Python package that generates fake data. It helps with
database bootstrapping, creating XML documents, persistence stress
testing, and data anonymization from production services.

%prep
%setup -q -n Faker-%{version}

%build
%python_build

%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/faker
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%post
%python_install_alternative faker

%postun
%python_uninstall_alternative faker

%if %{with test}
%check
%python_exec setup.py test
%endif

%files %{python_files}
%defattr(-,root,root,-)
%doc CHANGELOG.rst LICENSE.txt README.rst
%python_alternative %{_bindir}/faker
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by