Blob Blame History Raw
%global sname   pymod2pkg

%if 0%{?fedora}
%global with_python3 1
%endif

Name:             python-pymod2pkg
Version:          0.5.2
Release:          1%{?dist}
Summary:          python module name to package name map
License:          ASL 2.0
URL:              https://github.com/openstack/pymod2pkg.git
Source0:          https://pypi.io/packages/source/p/pymod2pkg/pymod2pkg-%{version}.tar.gz
BuildArch:        noarch


%description
pymod2pkg provides simple python function to translate python module names to
their corresponding distro package names.


%package -n python2-%{sname}
Summary:          python module name to package name map
BuildRequires:    python-setuptools
BuildRequires:    python2-devel
BuildRequires:    python2-pbr
%{?python_provide:%python_provide python2-%{sname}}

%description -n python2-%{sname}
pymod2pkg provides simple python function to translate python module names to
their corresponding distro package names.


%if 0%{?with_python3}
%package -n python3-%{sname}
Summary:          python module name to package name map
BuildRequires:    python3-setuptools
BuildRequires:    python3-devel
BuildRequires:    python3-pbr
%{?python_provide:%python_provide python3-%{sname}}

%description -n python3-%{sname}
pymod2pkg provides simple python function to translate python module names to
their corresponding distro package names.

This is a Python3 version.
%endif

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


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


%install
%py2_install
mv %{buildroot}%{_bindir}/%{sname} %{buildroot}%{_bindir}/%{sname}-%{python2_version}
ln -s ./%{sname}-%{python2_version} %{buildroot}%{_bindir}/%{sname}-2

%if 0%{?with_python3}
%py3_install
mv %{buildroot}%{_bindir}/%{sname} %{buildroot}%{_bindir}/%{sname}-%{python3_version}
ln -s ./%{sname}-%{python3_version} %{buildroot}%{_bindir}/%{sname}-3
ln -s ./%{sname}-%{python3_version} %{buildroot}%{_bindir}/%{sname}
%endif

%if !0%{?with_python3}
ln -s ./%{sname}-%{python2_version} %{buildroot}%{_bindir}/%{sname}
%endif


%files -n python2-%{sname}
%doc README.rst AUTHORS
%license LICENSE
%if !0%{?with_python3}
%{_bindir}/%{sname}
%endif
%{_bindir}/%{sname}-2*
%{python2_sitelib}/%{sname}
%{python2_sitelib}/pymod2pkg-%{version}-py?.?.egg-info

%if 0%{?with_python3}
%files -n python3-%{sname}
%doc README.rst AUTHORS
%license LICENSE
%{_bindir}/%{sname}
%{_bindir}/%{sname}-3*
%{python3_sitelib}/%{sname}
%{python3_sitelib}/pymod2pkg-%{version}-py?.?.egg-info
%endif


%changelog
* Fri Jul 29 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 0.5.2-1
- Upstream 0.5.2
- Add pymod2pkg utility
- Add python3

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.1-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Aug 11 2015 Jakub Ruzicka <jruzicka@redhat.com> 0.2.1-1
- Update to 0.2.1

* Wed Aug 05 2015 Jakub Ruzicka <jruzicka@redhat.com> 0.2-2
- Use python versioned macros
- List files instead of using wildcard

* Thu Jul 23 2015 Jakub Ruzicka <jruzicka@redhat.com> 0.2-1
- Update to 0.2

* Fri Jul 17 2015 Jakub Ruzicka <jruzicka@redhat.com> 0.1-1
- Initial version