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.12.1
Release:        1%{?dist}
Summary:        %{common_summary}

Group:          Applications/Internet
# 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

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

%description
%{common_description}


%package -n python2-%{srcname}
Summary:        %{common_summary}
Group:          System Environment/Libraries
Requires:       python2-backports-shutil_get_terminal_size
Requires:       python2-backports-shutil_which
Requires:       python2-crypto
Requires:       python2-futures
Requires:       python2-iso-639
Requires:       python2-iso3166
Requires:       python2-requests
Requires:       python2-singledispatch
Requires:       python2-pysocks
BuildRequires:  python-websocket-client
%{?python_provide:%python_provide python2-%{srcname}}

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


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

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


%package doc
Summary:        Documentation for %{name}
Group:          Documentation
Requires:       fontawesome-fonts-web

%description doc
%{common_description}

This package provides documentation for %{name}.


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

# 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
export STREAMLINK_USE_PYCRYPTO="true"
%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
export STREAMLINK_USE_PYCRYPTO="true"
%py2_install
%py3_install

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


%check
export STREAMLINK_USE_PYCRYPTO="true"
%{__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
* Mon May 07 2018 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.12.1-1
- Update to 0.12.1

* Wed Jan 24 2018 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.10.0-1
- Update to 0.10.0

* Tue Nov 14 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.9.0-1
- Update to 0.9.0

* Tue Oct 10 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.8.1-3
- Fix dependecy on python-websocket-client package

* Tue Sep 19 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.8.1-2
- Add missing dependecy on python-websocket-client package

* Tue Sep 19 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.8.1-1
- Update to 0.8.1

* Fri Jun 30 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.7.0-1
- Update to 0.7.0

* Thu May 11 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.6.0-1
- Update to 0.6.0

* Wed Apr 05 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.5.0-1
- Update to 0.5.0

* Fri Mar 10 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.4.0-1
- Update to 0.4.0

* Wed Feb 22 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.3.2-1
- Update to 0.3.2

* 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