%global srcname ntlm-auth
%global pypi_name %{srcname}
%global gh_owner jborean93
%global library_name ntlm_auth
%if 0%{?fedora}
# escaping for EPEL.
%global with_python3 1
%endif
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?py2_build: %global py2_build %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} build --executable="%{__python2} -s"}}
%{!?py2_install: %global py2_install %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}}}
%endif
Name: python-%{srcname}
Version: 1.0.6
Release: 1%{?dist}
Summary: Python 3 compatible NTLM library
License: LGPLv3+
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: https://github.com/%{gh_owner}/%{pypi_name}/archive/v%{version}.tar.gz#/%{srcname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python-setuptools
BuildRequires: python2-devel
%if 0%{?fedora}
BuildRequires: python2-six
%else
BuildRequires: python-six
%endif
%if 0%{?with_python3}
BuildRequires: python3-setuptools
BuildRequires: python3-devel
BuildRequires: python3-six
%endif
%if 0%{?rhel} && 0%{?rhel} <= 6
BuildRequires: python-ordereddict
%endif
# For tests
%if 0%{?fedora}
BuildRequires: python2-pytest
BuildRequires: python2-unittest2
BuildRequires: python2-mock
%else
BuildRequires: pytest
BuildRequires: python-unittest2
BuildRequires: python-mock
%endif
%if 0%{?with_python3}
BuildRequires: python3-pytest
BuildRequires: python3-unittest2
BuildRequires: python3-mock
%endif
%description
This package allows Python clients running on any operating system to provide
NTLM authentication to a supporting server.
%package -n python2-%{srcname}
Summary: Python 3 compatible NTLM library
%{?python_provide:%python_provide python2-%{srcname}}
%if 0%{?fedora}
Requires: python2-six
%else
Requires: python-six
%endif
%if 0%{?rhel} && 0%{?rhel} <= 6
Requires: python-ordereddict
%endif
%description -n python2-%{srcname}
This package allows Python clients running on any operating system to provide
NTLM authentication to a supporting server.
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: Python 3 compatible NTLM library
%{?python_provide:%python_provide python3-%{srcname}}
Requires: python3-six
%description -n python3-%{srcname}
This package allows Python clients running on any operating system to provide
NTLM authentication to a supporting server.
%endif
%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif
%install
# Must do the subpackages' install first because the scripts in /usr/bin are
# overwritten with every setup.py install.
%if 0%{?with_python3}
%py3_install
%endif
%py2_install
%check
# Allow this to work with pytest in el6
%{__python} -m pytest --ignore=tests/functional/test_iis.py tests
%if 0%{?with_python3}
%{__python3} -m pytest --ignore=tests/functional/test_iis.py tests
%endif
%files -n python2-%{srcname}
%doc CHANGES.md README.md
%license LICENSE
%{python2_sitelib}/%{library_name}
%{python2_sitelib}/%{library_name}-%{version}-py?.?.egg-info
%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc CHANGES.md README.md
%license LICENSE
%{python3_sitelib}/%{library_name}
%{python3_sitelib}/%{library_name}-%{version}-py?.?.egg-info
%endif
%changelog
* Mon Oct 10 2016 James Hogarth <james.hogarth@gmail.com> - 1.0.2-1
- Initial package.