#
# spec file for package python-bcrypt
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016, Martin Hauke <mardnh@gmx.de>
#
# 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
Name:           python-bcrypt
Version:        3.1.4
Release:        2.1
Summary:        BSD type 2a and 2b password hashing
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://github.com/pyca/bcrypt/
Source:         https://files.pythonhosted.org/packages/source/b/bcrypt/bcrypt-%{version}.tar.gz
BuildRequires:  %{python_module cffi}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module pytest >= 3.2.1}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module six}
BuildRequires:  fdupes
BuildRequires:  pkgconfig
BuildRequires:  python-rpm-macros
BuildRequires:  pkgconfig(libffi)
Requires:       python-six
%requires_eq    python-cffi
Provides:       python-py-bcrypt = %{version}
Obsoletes:      python-py-bcrypt < %{version}
# This is intended as a drop-in replacement for py-bcrypt
%ifpython2
Provides:       %{oldpython}-py-bcrypt = %{version}
Obsoletes:      %{oldpython}-py-bcrypt < %{version}
%endif
%python_subpackages

%description
This Python module supports creating (and verifying) password hashes
using the BSD-originating hashing methods known as "2a" and "2b".

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

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}/%{$python_sitearch}

%check
%python_exec setup.py test

%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitearch}/bcrypt
%{python_sitearch}/bcrypt-%{version}-py*.egg-info

%changelog
* Wed Aug 29 2018 tchvatal@suse.com
- Raise pytest requirement based on setup.py
* Wed Oct 25 2017 arun@gmx.de
- specfile:
  * update copyright year
- update to version 3.1.4:
  * Fixed compilation with mingw and on illumos.
* Sat May  6 2017 toddrme2178@gmail.com
- Don't provide python2-py-bcrypt, singlespec packages should use
  correct name.
* Sun Apr 30 2017 jengelh@inai.de
- Say which crypt methods this module actually supports.
* Sun Apr 30 2017 toddrme2178@gmail.com
- Update to version 3.1.3
  * Fixed a compilation issue on Solaris.
  * Added a warning when using too few rounds with kdf.
- Update to version 3.1.2
  * Fixed a compile issue affecting big endian platforms.
  * Fixed invalid escape sequence warnings on Python 3.6.
  * Fixed building in non-UTF8 environments on Python 2.
- Provides/Obsoletes "python-py-bcrypt" exactly.
- Change Summary/Description. Apparently "bcrypt is not "modern",
  not anymore."
* Thu Apr 27 2017 toddrme2178@gmail.com
- Fix license.
* Tue Apr 25 2017 toddrme2178@gmail.com
- Add Provides/Obsoletes py-bcrypt.
  This package is intended as a drop-in replacement for py-bcrypt
* Mon Apr 17 2017 axel.braun@gmx.de
- changes for singlespec
* Wed Oct  5 2016 dmueller@suse.com
- require the cffi version it was built against
* Thu Sep 29 2016 mardnh@gmx.de
- Update to version 3.1.1
  * Resolved a UserWarning when used with cffi 1.8.3.
* Thu Sep 15 2016 mardnh@gmx.de
- build with "-fno-strict-aliasing"
* Sun Sep 11 2016 mardnh@gmx.de
- initial package, version 3.1.0