Use py3 by default, build python buindings

This commit is contained in:
Denis Silakov 2018-07-18 14:55:38 +03:00
parent 2ecb676499
commit 1ff8e84a6f

View file

@ -1,7 +1,9 @@
%define pypi_name youtube_dl
Summary: Small command-line program to download videos from YouTube Summary: Small command-line program to download videos from YouTube
Name: youtube-dl Name: youtube-dl
Version: 2018.06.04 Version: 2018.06.04
Release: 1 Release: 2
License: Public Domain and GPLv2+ License: Public Domain and GPLv2+
Group: Video Group: Video
Url: https://yt-dl.org Url: https://yt-dl.org
@ -12,8 +14,11 @@ BuildRequires: ffmpeg
BuildRequires: gnupg2 BuildRequires: gnupg2
BuildRequires: pythonegg(nose) BuildRequires: pythonegg(nose)
BuildRequires: pythonegg(setuptools) BuildRequires: pythonegg(setuptools)
BuildRequires: pkgconfig(python2)
BuildRequires: pkgconfig(python3)
BuildRequires: python3egg(setuptools)
BuildArch: noarch BuildArch: noarch
Requires: python Requires: python3
Suggests: ffmpeg Suggests: ffmpeg
%description %description
@ -29,14 +34,62 @@ Small command-line program to download videos from YouTube and similar sites.
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
%package -n python2-%{name}
Summary: Python 2 bindings for %{name}
Group: Development/Python
BuildArch: noarch
Provides: python-%{name}
%description -n python2-%{name}
This is the Python 2 bindings for %{name}.
%files -n python2-%{name}
%{py_puresitedir}/%{pypi_name}
%{py_puresitedir}/%{pypi_name}-*-py%{py_ver}.egg-info
#-----------------------------------------------------------------------------
%package -n python3-%{name}
Summary: Python 3 bindings for %{name}
Group: Development/Python
BuildArch: noarch
%description -n python3-%{name}
This is the Python 3 bindings for %{name}.
%files -n python3-%{name}
%{py3_puresitedir}/%{pypi_name}
%{py3_puresitedir}/%{pypi_name}-*-py%{py3_ver}.egg-info
#-----------------------------------------------------------------------------
%prep %prep
%setup -qn %{name} %setup -qn %{name}
rm youtube-dl
cp -a . %{py3dir}
%build %build
%make %py2_build
pushd %{py3dir}
%py3_build
popd
%install %install
%py2_install
pushd %{py3dir}
%py3_install
popd
%makeinstall \ %makeinstall \
DESTDIR=%{buildroot} \ DESTDIR=%{buildroot} \
PREFIX=%{_prefix} \ PREFIX=%{_prefix} \
MANDIR=%{_mandir} MANDIR=%{_mandir}
# force the youtube-dl binary to use python 3 environment by default
sed -i -e 's,#!/usr/bin/env python,#!/usr/bin/env python3,' %{buildroot}%{_bindir}/%{name}
rm -rf %{buildroot}%{_prefix}/etc
rm -f %{buildroot}%{_datadir}/doc/youtube_dl/README.txt