A new user interface for you! Read more...

File cycle.spec of Package cycle

#
# spec file for package cycle
#
# Copyright (c) 2013 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/
#


Name:           cycle
Version:        0.3.1
Release:        0
License:        GPL-2.0+
Summary:        Calendar for Women
Url:            http://cycle.sourceforge.net/
Group:          Productivity/Scientific/Other
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
Source1:        export.png
Patch0:         cycle-0.3.1-directories.patch
Patch1:         cycle-0.3.1-dialogs_fix.patch
Patch2:         cycle-0.3.1-dialogs_message.patch
Patch3:         cycle-0.3.1-dialogs_strings.patch
Patch4:         cycle-0.3.1-cal_year_strings.patch
Patch5:         cycle-0.3.1-report_year_ical.patch
Patch6:         cycle-0.3.1-export_to_ical.patch
Patch7:         cycle-0.3.1-translations.patch
BuildRequires:  ImageMagick
BuildRequires:  hicolor-icon-theme
%if 0%{?suse_version} >= 1210
BuildRequires:  python-distribute
%else
BuildRequires:  python-setuptools
%endif
BuildRequires:  update-desktop-files
Requires:       python-wxWidgets
BuildArch:      noarch
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%py_requires

%description
Cycle is a calendar program for women. Given a cycle length or
statistics for several periods, it can calculate the days until
menstruation, the days of "safe" sex, the fertile period, and the days
to ovulations, and define the d.o.b. of a child. It allows the user to
write notes and helps to supervise the reception of hormonal
contraceptive tablets.

%lang_package

%prep
%setup -q
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
cp %{SOURCE1} bitmaps

# Convert Russian help file to UTF-8.
iconv -f KOI8-R -t UTF-8 README_ru.html | \
sed 's/charset=koi8-r/charset=UTF-8/' > README_ru.tmp && \
mv -f README_ru.tmp README_ru.html

# Convert German help file to UTF-8.
iconv -f CP1252 -t UTF-8 -o README_de.tmp README_de.html && \
mv -f README_de.tmp README_de.html

%build
# Compile locales.
for i in msg/*.po ; do
    msgfmt ${i} -o ${i%po}mo
done

%install
# Create desktop file.
cat > %{name}.desktop << EOF
[Desktop Entry]
Name=Cycle
GenericName=Calendar for Women
GenericName[ru]=Календарь для женщин
Comment=Menstrual Cycle Calendar
Comment[ru]=Календарь менструальных циклов
Type=Application
Exec=cycle
Icon=cycle
Categories=Office;Calendar;
StartupNotify=true
Terminal=false
EOF

# Install cycle.py and *.egg-info.
python setup.py install \
    --root=%{buildroot} \
    --prefix=%{_prefix}

# Install locales.
pushd msg
for i in *.mo ; do
    install -Dm 0644 ${i} \
    %{buildroot}%{_datadir}/locale/${i%%.mo}/LC_MESSAGES/%{name}.mo
done
popd

# Install other files.
install -dm 0755 \
%{buildroot}{%{_bindir},%{_datadir}/%{name}/{bitmaps,icons/{large,mini}}}
ln -s %{python_sitelib}/%{name}.py %{buildroot}%{_bindir}/%{name}
install -m 0644 bitmaps/* \
    %{buildroot}%{_datadir}/%{name}/bitmaps
install -m 0644 icons/%{name}.* \
    %{buildroot}%{_datadir}/%{name}/icons
install -m 0644 icons/large/%{name}.* \
    %{buildroot}%{_datadir}/%{name}/icons/large
install -m 0644 icons/mini/%{name}.* \
    %{buildroot}%{_datadir}/%{name}/icons/mini
install -m 0644 \
    cal_year.py dialogs.py p_rotor.py save_load.py set_dir.py \
    %{buildroot}%{python_sitelib}

# Python byte compile.
pushd %{buildroot}%{python_sitelib}
%py_compile .
popd

# Install icons of various sizes.
for size in 48x48 32x32 16x16 ; do
    install -dm 0755 \
    %{buildroot}%{_datadir}/icons/hicolor/${size}/apps
done
convert icons/mini/%{name}.xpm \
    %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/%{name}.png
convert icons/%{name}.xpm \
    %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
convert icons/large/%{name}.xpm \
    %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png

# Install man page.
install -Dm 0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1

%find_lang %{name}
%suse_update_desktop_file -i %{name}

%post
%icon_theme_cache_post

%postun
%icon_theme_cache_postun

%files
%defattr(-,root,root,-)
%doc CHANGELOG COPYRIGHT README README.html README_de.html
%doc README_ru.html THANKS
%{_bindir}/%{name}
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/*/%{name}.*
%doc %{_mandir}/man?/*
%attr(0755,root,root) %{python_sitelib}/%{name}.py
%{python_sitelib}/*.egg-info
%{python_sitelib}/cal_year.py
%{python_sitelib}/dialogs.py
%{python_sitelib}/p_rotor.py
%{python_sitelib}/save_load.py
%{python_sitelib}/set_dir.py
%{python_sitelib}/*.pyc

%files lang -f %{name}.lang

%changelog