File qtodotxt.spec of Package qtodotxt
#
# spec file for package qtodotxt
#
# Copyright (c) 2014 SUSE LINUX Products 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 _name QTodoTxt
Name: qtodotxt
Version: 1.4.0
Release: 0
Summary: Cross-platform UI client for todo.txt files
License: GPL-3.0+
Group: Productivity/Office/Organizers
Url: https://github.com/mNantern/QTodoTxt
Source: https://github.com/mNantern/%{_name}/archive/%{version}.tar.gz
BuildRequires: fdupes
BuildRequires: hicolor-icon-theme
BuildRequires: python3-devel
BuildRequires: update-desktop-files
Requires: python3-qt4
BuildArch: noarch
%description
QTodoTxt is a graphical interface for todo.txt format.
Todo.txt is a popular, minimalistic TODO list format in which the data
is stored in a simple text file. Since todo.txt is both machine and
human-readable, you can check out your tasks with a simple text editor
from any OS, synchronize it with cloud sync tools such as ownCloud, etc.
%prep
%setup -q -n %{_name}-%{version}
sed -e 's/^Icon=.*$/Icon=%{name}/;/^Keywords/d' packaging/Debian/%{name}.desktop > %{name}.desktop
%build
# Nothing to build.
%install
install -Dm 0755 bin/%{name} %{buildroot}%{_datadir}/%{name}/bin/%{name}
cp -rf {%{name},artwork} %{buildroot}%{_datadir}/%{name}/
# A tricky way to get all available icon sizes.
ls artwork/icon/ | sed -n 's/.*-\([0-9]*\).png/\1/p' | while read size; do
install -Dm 0644 artwork/icon/qTodo-$size.png %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}.png
done
install -Dm 0644 %{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
dirname $(find %{buildroot}%{_datadir} -name '*.py') | sort -u | while read dir; do
pushd "$dir"
ls *.py | while read py; do
# Tranfer to PyQt4 from PySide.
sed -i 's/PySide/PyQt4/g;s/\(QtCore.\)\(Signal\)/\1pyqt\2/g;s/\(QtCore.\)\(Slot\)/\1pyqt\2/g' "$py"
# One more specific hack about PyQt4.
sed -i 's/\(QAbstractItemView.\)SelectionMode.\(ExtendedSelection\)/\1\2/g' "$py"
# Add execution bit to scripts with shebangs and remove from others.
if [[ "$(head -c2 "$py"; echo)" == "#!" ]]; then
chmod a+x "$py"
else
chmod a-x "$py"
fi
done
# Generate .pyc.
touch -c *.py
%py3_compile .
popd
done
mkdir -p %{buildroot}%{_bindir}/
ln -s %{_datadir}/%{name}/bin/%{name} %{buildroot}/%{_bindir}/%{name}
%suse_update_desktop_file -r -G %{_name} %{name} Utility DesktopUtility
%fdupes %{buildroot}
%post
%desktop_database_post
%icon_theme_cache_post
%postun
%desktop_database_postun
%icon_theme_cache_postun
%files
%defattr(-,root,root)
%doc AUTHORS gpl.txt
%{_bindir}/%{name}
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/
%changelog