Blob Blame History Raw
%global srcname streamlink
%global common_summary Python library for extracting streams from various websites
%global common_description Streamlink is a command-line utility that pipes video streams from various\
services into a video player, such as VLC. The main purpose of Streamlink is to\
allow the user to avoid buggy and CPU heavy flash plugins but still be able to\
enjoy various streamed content. There is also an API available for developers\
who want access to the video stream data. This project was forked from\
Livestreamer, which is no longer maintained.

Name:           python-%{srcname}
Version:        0.3.2
Release:        1%{?dist}
Version:        0.3.0
Release:        2%{?dist}
Summary:        %{common_summary}

Group:          System Environment/Libraries
# src/streamlink/packages/requests_file.py is ASL 2.0
License:        BSD and ASL 2.0
URL:            https://streamlink.github.io/
Source0:        %{srcname}-%{version}-without-win32-binaries.tar.gz
# streamlink tarball contains FFmpeg and rtmpdump binaries for Windows which
# cannot be uploaded on Fedora servers for legal reasons. Therefore we use
# this script to download the tarball and remove forbidden files
Source1:        %{name}-generate-tarball.sh
# Replace dependency on pycryptodome (not available in Fedora) by pycrypto
Patch0:         %{name}-0.3.0-pycrypto.patch

BuildRequires:  fontpackages-devel
BuildRequires:  python2-devel
BuildRequires:  python3-devel
# Needed for documentation
BuildRequires:  python3-sphinx
# Needed for tests
BuildRequires:  python-backports-shutil_get_terminal_size
BuildRequires:  python-backports-shutil_which
BuildRequires:  python-crypto
BuildRequires:  python-futures
BuildRequires:  python-iso-639
BuildRequires:  python-iso3166
BuildRequires:  python-mock
BuildRequires:  python-pytest
BuildRequires:  python-requests
BuildRequires:  python3-crypto
BuildRequires:  python3-iso-639
BuildRequires:  python3-iso3166
BuildRequires:  python3-mock
BuildRequires:  python3-pytest
BuildRequires:  python3-requests
BuildArch:      noarch

%description
%{common_description}


%package -n python2-%{srcname}
Summary:        %{common_summary}
Requires:       python-backports-shutil_get_terminal_size
Requires:       python-backports-shutil_which
Requires:       python-crypto
Requires:       python-futures
Requires:       python-iso-639
Requires:       python-iso3166
Requires:       python-requests
Requires:       python-singledispatch
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
%{common_description}


%package -n python3-%{srcname}
Summary:        %{common_summary}
Requires:       python3-crypto
Requires:       python3-requests
Requires:       python3-iso-639
Requires:       python3-iso3166
Requires:       python3-singledispatch
%{?python_provide:%python_provide python3-%{srcname}}
Provides:       %{srcname} = %{version}-%{release}

%description -n python3-%{srcname}
%{common_description}


%package doc
Summary:        Documentation for %{name}
Requires:       fontawesome-fonts-web
%{?python_provide:%python_provide python3-%{srcname}}

%description doc
%{common_description}

This package provides documentation for %{name}.


%prep
%autosetup -n %{srcname}-%{version}

# Delete dummy test requiring pycountry, not available in Fedora
rm tests/test_localization_pycountry.py
# Delete broken test (fixed in the next upstream release)
rm tests/test_localization.py

# Remove shebang
for i in $(find src/%{srcname}/ -name "*.py"); do
    sed '1{\@^#!/usr/bin/env python@d}' $i >$i.new && \
    touch -r $i $i.new && \
    mv $i.new $i
done


%build
%py2_build
%py3_build

# Generate documentation
%{__python3} setup.py build_sphinx -b man
%{__python3} setup.py build_sphinx -b html
rm build/sphinx/html/.buildinfo

# Drop bundled web fonts in HTML documentation
pushd build/sphinx/html/_static/fonts/
rm *
ln -s %{_fontbasedir}/fontawesome/fontawesome-webfont.eot .
popd


%install
%py2_install
%py3_install

# Install man page
install -Dpm 0644 build/sphinx/man/%{srcname}.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{srcname}.1


%check
%{__python2} setup.py test
%{__python3} setup.py test


%files -n python2-%{srcname}
%doc AUTHORS CHANGELOG.rst CONTRIBUTING.md README.md
%license LICENSE
%{python2_sitelib}/*


%files -n python3-%{srcname}
%doc AUTHORS CHANGELOG.rst CONTRIBUTING.md README.md
%license LICENSE
%{_bindir}/%{srcname}
%{python3_sitelib}/*
%{_mandir}/man1/%{srcname}.1.*


%files doc
%doc build/sphinx/html/
%license LICENSE


%changelog
* Tue Feb 14 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.3.2-1
- Update to 0.3.2

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Jan 26 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.3.0-1
- Update to 0.3.0

* Sat Jan 07 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.2.0-3
- Add license to doc subpackage

* Sat Jan 07 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.2.0-2
- Fix license tag
- Move documentation to a subpackage
- Enable tests

* Sun Dec 18 2016 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.2.0-1
- Update to 0.2.0

* Fri Dec 16 2016 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.1.0-1
- Initial RPM release