%global srcname pysrt Name: python-%{srcname} Version: 1.1.1 Release: 2%{?dist} Summary: Library used to edit or create SubRip files License: GPLv3 URL: https://github.com/byroot/pysrt Source: https://github.com/byroot/%{srcname}/archive/v%{version}/%{srcname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python3-devel # BuildRequires for tests: BuildRequires: python-chardet BuildRequires: python3-chardet %global _description\ pysrt is a Python library used to edit or create SubRip files. %description %_description %package -n python2-%{srcname} Summary: %summary %{?python_provide:%python_provide python2-%{srcname}} %description -n python2-%{srcname} %_description %package -n python3-%{srcname} Summary: %summary %{?python_provide:%python_provide python3-%{srcname}} %description -n python3-%{srcname} %_description %prep %autosetup -n %{srcname}-%{version} %build %py2_build %py3_build %install %py2_install # Remove shebang from Python2 libraries for lib in `find %{buildroot}%{python2_sitelib} -name "*.py"`; do sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new && touch -r $lib $lib.new && mv $lib.new $lib done %py3_install # Remove shebang from Python3 libraries for lib in `find %{buildroot}%{python3_sitelib} -name "*.py"`; do sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new && touch -r $lib $lib.new && mv $lib.new $lib done %check %{__python2} setup.py test %{__python3} setup.py test %files -n python2-%{srcname} %doc README.rst %license LICENCE.txt %{python2_sitelib}/%{srcname} %{python2_sitelib}/%{srcname}-%{version}-py*.egg-info %files -n python3-%{srcname} %doc README.rst %license LICENCE.txt %{_bindir}/srt %{python3_sitelib}/%{srcname} %{python3_sitelib}/%{srcname}-%{version}-py*.egg-info %changelog * Thu Aug 31 2017 Juan Orti Alcaine - 1.1.1-2 - Update Source URL - Remove shebang from libraries * Mon Aug 28 2017 Juan Orti Alcaine - 1.1.1-1 - Initial RPM release