Blob Blame History Raw
# Created by pyp2rpm-0.5.1
%global pypi_name pyp2rpm
%global with_python3 1

Name:           %{pypi_name}
Version:        0.5.2
Release:        1%{?dist}
Summary:        Convert Python packages to RPM SPECFILES

License:        MIT
URL:            http://pypi.python.org/pypi/pyp2rpm/0.5.1
Source0:        http://pypi.python.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
# to get tests:
# git clone git@bitbucket.org:bkabrda/pyp2rpm.git && cd pyp2rpm
# git checkout v0.5.2 && tar czf pyp2rpm-0.5.2-tests.tgz tests/
Source1:        %{name}-%{version}-tests.tgz
BuildArch:      noarch
 
BuildRequires:  python-devel
BuildRequires:  pytest
BuildRequires:  python-flexmock >= 0.9.3
BuildRequires:  python-jinja2
BuildRequires:  python-setuptools
 
%if %{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-pytest
BuildRequires:  python3-flexmock >= 0.9.3
BuildRequires:  python3-jinja2
BuildRequires:  python3-setuptools
%endif # if with_python3
 
Requires:       python-jinja2
Requires:       python-setuptools

%description
Convert Python packages to RPM SPECFILES. The packages can be downloaded from
PyPI and the produced SPEC is in line with Fedora Packaging Guidelines.

Users can provide their own templates for rendering the package metadata. Both
the package source and metadata can be extracted from PyPI or from local
filesystem (local file doesn't provide that much information though).

%if 0%{?with_python3}
%package -n     python3-%{pypi_name}
Summary:        Convert Python packages to RPM SPECFILES

Requires:       python3-jinja2
Requires:       python3-setuptools

%description -n python3-%{pypi_name}
Convert Python packages to RPM SPECFILES. The packages can be downloaded from
PyPI and the produced SPEC is in line with Fedora Packaging Guidelines.

Users
can provide their own templates for rendering the package metadata. Both the
package
source and metadata can be extracted from PyPI or from local filesystem
(local file doesn't
provide that much information though).
%endif # with_python3


%prep
%setup -q -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info


%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'

%endif # with_python3


%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3


%install
# Must do the subpackages' install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
mv %{buildroot}%{_bindir}/pyp2rpm %{buildroot}/%{_bindir}/python3-pyp2rpm
popd
%endif # with_python3

%{__python} setup.py install --skip-build --root %{buildroot}


%check
tar xzf %{SOURCE1}
PYTHONPATH=$(pwd) py.test

%if 0%{?with_python3}
pushd %{py3dir}
tar xzf %{SOURCE1}
PYTHONPATH=$(pwd) py.test-%{python3_version}
popd
%endif


%files
%doc README.rst LICENSE
%{_bindir}/pyp2rpm
%{python_sitelib}/%{pypi_name}lib
%{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst LICENSE
%{_bindir}/python3-pyp2rpm
%{python3_sitelib}/%{pypi_name}lib
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif # with_python3


%changelog
* Wed Mar 13 2013 Bohuslav Kabrda <bkabrda@redhat.com> - 0.5.2-1
- Update to version 0.5.2, fixes #920782.

* Mon Dec 03 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 0.5.1-5
- Properly require python3 deps only from the python3 subpackage.

* Mon Aug 06 2012 David Malcolm <dmalcolm@redhat.com> - 0.5.1-4
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3

* Thu Aug  2 2012 David Malcolm <dmalcolm@redhat.com> - 0.5.1-3
- generalize py.test reference to work with Python 3.*

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Mon Jun 18 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 0.5.1-1
- Initial package.