Blob Blame Raw
%global pypi_name entry_point_inspector
%global sname epi

# Python3 support in OpenStack starts with version 3.5,
# which is only in Fedora 24+
%if 0%{?fedora} >= 24
%global with_python3 1
%global default_python 3
%else
%global default_python 2
%endif

Name:           python-%{sname}
Version:        0.1
Release:        4%{?dist}
Summary:        Tool for looking at the entry point plugins on a system

License:        ASL 2.0
URL:            https://github.com/dhellmann/entry_point_inspector
Source0:        https://files.pythonhosted.org/packages/source/e/%{pypi_name}/%{pypi_name}-%{version}.tar.gz

# Pull request for including these two files
# https://github.com/dhellmann/entry_point_inspector/pull/3
Source1:        https://raw.githubusercontent.com/dhellmann/entry_point_inspector/master/LICENSE
Source2:        https://raw.githubusercontent.com/dhellmann/entry_point_inspector/master/README.rst
Source3:        https://raw.githubusercontent.com/dhellmann/entry_point_inspector/master/announce.rst

BuildArch:      noarch

BuildRequires:  python-setuptools
BuildRequires:  python2-devel
# test requirements
BuildRequires:  python-mock
BuildRequires:  python-nose
BuildRequires:  python-coverage
BuildRequires:  python-cliff

%description
Entry Point Inspector is a tool for looking at the entry point plugins
installed on a system.

%package -n     python2-%{sname}
Summary:        Tool for looking at the entry point plugins on a system
%{?python_provide:%python_provide python2-%{sname}}

Requires:       python-cliff
Requires:       python-setuptools

%description -n python2-%{sname}
Entry Point Inspector is a tool for looking at the entry point plugins
installed on a system.

%if 0%{?with_python3}
%package -n     python3-%{sname}
Summary:        Tool for looking at the entry point plugins on a system
%{?python_provide:%python_provide python3-%{sname}}

BuildRequires:  python3-setuptools
BuildRequires:  python3-devel
# test requirements
BuildRequires:  python3-mock
BuildRequires:  python3-nose
BuildRequires:  python3-coverage
BuildRequires:  python3-cliff

Requires:       python3-cliff
Requires:       python3-setuptools

%description -n python3-%{sname}
Entry Point Inspector is a tool for looking at the entry point plugins
installed on a system.
%endif

%prep
%autosetup -n %{pypi_name}-%{version}
cp -p %{SOURCE1} %{SOURCE2} %{SOURCE3} .

%build
%py2_build

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

%install
%py2_install
mv %{buildroot}%{_bindir}/%{sname} %{buildroot}%{_bindir}/python2-%{sname}

%if 0%{?with_python3}
%py3_install
mv %{buildroot}%{_bindir}/%{sname} %{buildroot}%{_bindir}/python3-%{sname}
%endif

%if 0%{?default_python} >= 3
ln -s %{_bindir}/python3-%{sname} %{buildroot}%{_bindir}/%{sname}
%else
ln -s %{_bindir}/python2-%{sname} %{buildroot}%{_bindir}/%{sname}
%endif

%check
%{__python2} setup.py nosetests

%if 0%{?with_python3}
%{__python3} setup.py nosetests
%endif

%files -n python2-%{sname}
%license LICENSE
%doc README.rst announce.rst
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%if 0%{?default_python} <= 2
%{_bindir}/%{sname}
%endif
%{_bindir}/python2-%{sname}


%if 0%{?with_python3}
%files -n python3-%{sname}
%license LICENSE
%doc README.rst announce.rst
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%if 0%{?default_python} >= 3
%{_bindir}/%{sname}
%endif
%{_bindir}/python3-%{sname}
%endif

%changelog
* Thu Oct 20 2016 Chandan Kumar <chkumar246@gmail.com> - 0.1-4
- Fixed package name

* Wed Sep 28 2016 Chandan Kumar <chkumar246@gmail.com> - 0.1-3
- Fixed source macro in prep section

* Wed Sep 28 2016 Chandan Kumar <chkumar246@gmail.com> - 0.1-2
- Added sources for LICENSE, README.rst and announce.rst
- Included check macro to run unit tests

* Tue Sep 27 2016 Chandan Kumar <chkumar246@gmail.com> - 0.1-1
- Initial package.