# Created by pyp2rpm-0.5.1 %global pypi_name pyp2rpm %global with_python3 1 Name: %{pypi_name} Version: 0.5.1 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.1 && tar czf pyp2rpm-0.5.1-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 %if %{?with_python3} Requires: python3-jinja2 Requires: python3-setuptools %endif # if with_python3 %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 %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-3.2 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 * Mon Jun 18 2012 Bohuslav Kabrda - 0.5.1-1 - Initial package.