File youdao-dict.spec of Package youdao-dict

#
# spec file for youdao-dict
#
# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2016 Hillwood Yang <hillwood@opensuse.org>
#
# 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/
#

%ifarch x86_64
%define  arch  amd64
%else
%define  arch  i386
%endif
 
Name:           youdao-dict
Version:        1.1.0
Release:        0
Summary:        The most popular dictionary software in China 
Group:          Productivity/Office/Dictionary
License:        GPL-3.0 
URL:            http://cidian.youdao.com/index-linux.html
Source0:        http://codown.youdao.com/cidian/linux/%{name}_%{version}-0~%{arch}.tar.gz
Patch0:         youdao-dbus-1.1.0.patch
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
BuildRequires:  fdupes
Requires:       dbus-1-python3
Requires:       python3-qt5
Requires:       python3-xlib
Requires:       python3-lxml
Requires:       python3-WebOb
Requires:       python3-xdg
Requires:       python3-Pillow
Requires:       python3-pytesseract
Requires:       libQtQuick5
Requires:       libqt5-qtquickcontrols
Requires:       tesseract-ocr-traineddata-english
Requires:       tesseract-ocr-traineddata-chinese_simplified
Requires:       tesseract-ocr-traineddata-chinese_traditional
Requires:       %{name}-data-%{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
%description
Youdao Dictionary, developed by NetEase Youdao and Deepin in the Internet age, 
is both the most practical, free, powerful translation software and 
the most popular dictionary software in China with more than 500 
million users. It is a multilingual translation dictionary in your 
pocket with more than 650,000 English-Chinese words and more than 590,000 
Chinese-English words built in, allowing you to easily look up a word 
even offline. 

This package is the main application of youdao-dict, it is an opensource 
application. 

%package data
Summary:        The offline dictionary database of youdao-dict
License:        youdaodict-proprietary
Group:          Productivity/Office/Dictionary

%description data
Youdao Dictionary, developed by NetEase Youdao and Deepin in the Internet age, 
is both the most practical, free, powerful translation software and 
the most popular dictionary software in China with more than 500 
million users. It is a multilingual translation dictionary in your 
pocket with more than 650,000 English-Chinese words and more than 590,000 
Chinese-English words built in, allowing you to easily look up a word 
even offline. 

This package is offline dictionary database of youdao-dict, it is non-oss 
package.
 
  
%prep
%setup -q -n src
%if 0%{suse_version} >= 1316
%patch0 -p1
%endif 
 
%build
 
%install
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_datadir}/youdao-dict
install -d %{buildroot}%{_datadir}/applications
install -d %{buildroot}%{_datadir}/dbus-1/services
install -d %{buildroot}%{_datadir}/icons/hicolor/48x48/apps
install -d %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
install -d %{buildroot}%{_sysconfdir}/xdg/autostart
cd ..
cp -r src/* %{buildroot}/%{_datadir}/%{name}
cp -r data/hicolor/* %{buildroot}/%{_datadir}/icons/hicolor/
cp data/youdao-dict.desktop %{buildroot}/%{_datadir}/applications/
cp data/youdao-dict-autostart.desktop %{buildroot}/%{_sysconfdir}/xdg/autostart/
cp data/com.youdao.backend.service %{buildroot}/%{_datadir}/dbus-1/services/
chmod 755 %{buildroot}/%{_datadir}/%{name}/main.py
chmod 755 %{buildroot}/%{_datadir}/%{name}/youdao-dict-backend.py
cd %{buildroot}%{_bindir}
ln -s ../../usr/share/youdao-dict/main.py youdao-dict

%suse_update_desktop_file %{name} Office Dictionary

%fdupes %{buildroot}
 
%post
%icon_theme_cache_post
 
%postun
%icon_theme_cache_post
 
%posttrans
%icon_theme_cache_post
 
%files
%defattr(-,root,root,-)
%doc ../license_ch.txt ../copyright ../README.md
%{_bindir}/youdao-dict
%dir %{_datadir}/dbus-1
%dir %{_datadir}/dbus-1/services
%{_datadir}/dbus-1/services/com.youdao.backend.service
%{_datadir}/applications/youdao-dict.desktop
%{_datadir}/icons/hicolor/
%{_datadir}/youdao-dict/
%{_sysconfdir}/xdg/autostart/youdao-dict-autostart.desktop
%exclude %{_datadir}/%{name}/app/plugins/youdao/youdao.db
%exclude %{_datadir}/%{name}/app/plugins/youdao/deepin_dict.so

%files data
%defattr(-,root,root,-)
%{_datadir}/%{name}/app/plugins/youdao/youdao.db
%{_datadir}/%{name}/app/plugins/youdao/deepin_dict.so

%changelog
openSUSE Build Service is sponsored by