Blob Blame History Raw
%global pypi_name pluginlib
%global sum  A framework for creating and importing plugins in Python
%global desc Pluginlib is a Python framework for creating and importing plugins.\
Pluginlib makes creating plugins for your project simple.

%bcond_without python3

# Drop Python 2 with Fedora 30 and EL8
%if (0%{?fedora} && 0%{?fedora} < 30) || (0%{?rhel} && 0%{?rhel} < 8)
  %bcond_without python2
%else
  %bcond_with python2
%endif


Name:           python-%{pypi_name}
Version:        0.6.1
Release:        1%{?dist}
Summary:        %{sum}

License:        MPLv2.0
URL:            https://github.com/Rockhopper-Technologies/pluginlib
Source0:        https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

%if %{with python2}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-mock

# Additional build requirements for Python 2.6
%if 0%{?el6}
BuildRequires:  python-unittest2
BuildRequires:  python-importlib
%endif
%endif

%if %{with python3}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
%endif

%if 0%{?with_python3_other}
BuildRequires:  python%{python3_other_pkgversion}-devel
BuildRequires:  python%{python3_other_pkgversion}-setuptools
%endif

%description
%{desc}


# Python 2 package
%if %{with python2}
%package -n     python2-%{pypi_name}

Summary:        %{sum}
%{?python_provide:%python_provide python2-%{pypi_name}}
Requires:       python2-setuptools

%if 0%{?el6}
Requires:  python-importlib
%endif

%description -n python2-%{pypi_name}
%{desc}
%endif

# Python 3 package
%if %{with python3}
%package -n     python%{python3_pkgversion}-%{pypi_name}
Summary:        %{sum}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
Requires:       python%{python3_pkgversion}-setuptools

%description -n python%{python3_pkgversion}-%{pypi_name}
%{desc}
%endif

# Python 3 other package
%if 0%{?with_python3_other}
%package -n     python%{python3_other_pkgversion}-%{pypi_name}
Summary:        %{sum}
%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{pypi_name}}
Requires:       python%{python3_other_pkgversion}-setuptools

%description -n python%{python3_other_pkgversion}-%{pypi_name}
%{desc}
%endif


%prep
%autosetup -p0 -n %{pypi_name}-%{version}

# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info


%build
%if %{with python2}
%py2_build
%endif

%if %{with python3}
%py3_build
%endif

%if 0%{?with_python3_other}
%py3_other_build
%endif


%install
%if 0%{?with_python3_other}
%py3_other_install
%endif

%if %{with python3}
%py3_install
%endif

%if %{with python2}
%py2_install
%endif


%check
%if %{with python2}
%{__python2} setup.py test
%endif

%if %{with python3}
%{__python3} setup.py test
%endif

%if 0%{?with_python3_other}
%{__python3_other} setup.py test
%endif


%if %{with python2}
%files -n python2-%{pypi_name}
%doc README*
%license LICENSE
%{python2_sitelib}/pluginlib*
%endif

%if %{with python3}
%files -n python%{python3_pkgversion}-%{pypi_name}
%doc README*
%license LICENSE
%{python3_sitelib}/pluginlib*
%endif

%if 0%{?with_python3_other}
%files -n python%{python3_other_pkgversion}-%{pypi_name}
%doc README*
%license LICENSE
%{python3_other_sitelib}/pluginlib*
%endif

%changelog
* Tue Aug 07 2018 Avram Lubkin <aviso@rockhopper.net> - 0.6.1-1
- 0.6.1 Release

* Sat Aug 04 2018 Avram Lubkin <aviso@rockhopper.net> - 0.6.0-2
- EL6 build requirements should only apply to Python 2 

* Mon Jul 23 2018 Avram Lubkin <aviso@rockhopper.net> - 0.6.0-1
- 0.6.0 Release

* Mon Jul 23 2018 Avram Lubkin <aviso@rockhopper.net> - 0.5.1-2
- Change with_pythonX to use bcond_with(out)
- Make files sections more specific

* Mon Jul 23 2018 Avram Lubkin <aviso@rockhopper.net> - 0.5.1-1
- Initial package.