14
0
Files
python-subliminal/python-subliminal.spec

134 lines
5.0 KiB
RPMSpec
Raw Normal View History

#
# spec file for package python-subliminal
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define subliminal_priority 30
Name: python-subliminal
Version: 2.0.4
Release: 0
Summary: Python library to search and download subtitles
License: MIT
Group: Development/Languages/Python
Url: https://github.com/Diaoul/subliminal
Source0: http://pypi.python.org/packages/source/s/subliminal/subliminal-%{version}.tar.gz
Source1: subliminal.1
BuildRequires: fdupes
BuildRequires: python-argparse >= 1.3.0
BuildRequires: python-babelfish >= 0.5.5
BuildRequires: python-beautifulsoup4 >= 4.4.0
BuildRequires: python-chardet >= 2.3.0
BuildRequires: python-click >= 4.1
BuildRequires: python-devel >= 2.7
BuildRequires: python-dogpile.cache >= 0.6.0
BuildRequires: python-enzyme >= 0.4.1
BuildRequires: python-guessit >= 2.0.1
BuildRequires: python-html5lib >= 0.999999
BuildRequires: python-pbr >= 1.3.0
BuildRequires: python-pysrt >= 1.0.1
BuildRequires: python-python-dateutil >= 2.2
BuildRequires: python-requests >= 2.7.0
BuildRequires: python-setuptools >= 18.0.1
BuildRequires: python-six >= 1.9.0
BuildRequires: python-stevedore >= 1.6.0
BuildRequires: python-xdg >= 0.25
Requires: python-appdirs >= 1.3
Requires: python-argparse >= 1.3.0
Requires: python-babelfish >= 0.5.4
Requires: python-beautifulsoup4 >= 4.4.0
Requires: python-chardet >= 2.3.0
Requires: python-click >= 4.1
Requires: python-dogpile.cache >= 0.6.0
Requires: python-enzyme >= 0.4.1
Requires: python-futures >= 3.0
Requires: python-guessit >= 2.0.1
Requires: python-html5lib >= 0.999999
Requires: python-python-dateutil >= 2.2
%if 0%{?suse_version} <= 1320 && 0%{?is_opensuse} == 0
Requires: python-ndg-httpsclient
%endif
Requires: python-pbr >= 1.3.0
Requires: python-pysrt >= 1.0.1
Requires: python-rarfile >= 2.7
Requires: python-requests >= 2.7.0
Requires: python-six >= 1.9.0
Requires: python-stevedore >= 1.6.0
Requires: python-xdg >= 0.25
Recommends: python-colorlog >= 2.6.0
Requires(post): update-alternatives
Requires(postun): update-alternatives
Conflicts: subliminal
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
Provides: subliminal = %{version}
Obsoletes: subliminal < %{version}
%description
Subliminal is a python library to search and download subtitles.
It comes with an easy to use CLI suitable for direct use or cron jobs.
%prep
%setup -n subliminal-%{version}
# set the exe name
sed -e 's/subliminal = subliminal.cli:subliminal/subliminal-%{py_ver} = subliminal.cli:subliminal/' -i setup.py
gzip < %{SOURCE1} > subliminal-%{py_ver}.1.gz
%build
python setup.py build
%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
mkdir -p %{buildroot}/%{_docdir}/%{name}
mkdir -p %{buildroot}/%{_mandir}/man1
install -m 644 subliminal-%{py_ver}.1.gz -t %{buildroot}/%{_mandir}/man1
# Setup update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/subliminal
touch %{buildroot}%{_sysconfdir}/alternatives/subliminal.1.gz
ln -s -f %{_sysconfdir}/alternatives/subliminal %{buildroot}%{_bindir}/subliminal
ln -s -f %{_sysconfdir}/alternatives/subliminal.1.gz %{buildroot}%{_mandir}/man1/subliminal.1.gz
%fdupes -s %{buildroot}
%post
update-alternatives \
--install %{_bindir}/subliminal subliminal %{_bindir}/subliminal-%{py_ver} \
%{subliminal_priority} \
--slave %{_mandir}/man1/subliminal.1.gz subliminal.1.gz %{_mandir}/man1/subliminal-%{py_ver}.1.gz
%postun
# Note: we don't use "$1 -eq 0", to avoid issues if the package gets renamed
if [ ! -f %{_bindir}/subliminal-%{py_ver} ]; then
update-alternatives --remove subliminal %{_bindir}/subliminal-%{py_ver}
fi
%files
%defattr(-,root,root)
%doc HISTORY.rst LICENSE README.rst
%{_bindir}/subliminal
%{_bindir}/subliminal-%{py_ver}
%ghost %{_sysconfdir}/alternatives/subliminal
%{_mandir}/man1/subliminal.1.gz
%{_mandir}/man1/subliminal-%{py_ver}.1.gz
%ghost %{_sysconfdir}/alternatives/subliminal.1.gz
%dir %{python_sitelib}/subliminal
%{python_sitelib}/subliminal/*
%{python_sitelib}/subliminal-%{version}-py%{py_ver}.egg-info
%changelog