Blob Blame History Raw
%global srcname ReText
%global with_tests 1

Name:           retext
Version:        5.3.0
Release:        4%{?dist}
License:        GPLv3+
Summary:        Text editor for Markdown and reStructuredText
Summary(de):    Texteditor für Markdown und reStructuredText
URL:            http://sourceforge.net/p/%{name}/home/%{srcname}
Source0:        http://downloads.sourceforge.net/project/%{name}/%{srcname}-5.0/%{srcname}-%{version}.tar.gz

# The template for man page translations can be created with this command:
# po4a-updatepo -v -M utf-8 -f man -m retext.1 -p retext-man.pot
# English man pages are taken from the Debian package.
Source1:        https://mariobl.fedorapeople.org/Retext/%{name}-man-de.po
Source2:        https://mariobl.fedorapeople.org/Retext/%{name}.1
Patch0:        %{name}-tab.py.diff

BuildArch:      noarch

BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib
BuildRequires:  libpng-devel
BuildRequires:  librsvg2-devel
BuildRequires:  librsvg2-tools
BuildRequires:  ImageMagick
BuildRequires:  python3-devel
BuildRequires:  python3-markups
BuildRequires:  po4a
BuildRequires:  qt5-qttools-devel

%if 0%{?with_tests}
BuildRequires:  python3-qt5
BuildRequires:  qt5-qtbase-gui
%endif # with_tests

Requires:       hicolor-icon-theme
Requires:       python3-docutils
Requires:       python3-enchant
Requires:       python3-markdown
Requires:       python3-markups
Requires:       python3-qt5
Requires:       python3-qt5-webkit
Requires:       qt5-qtlocation
Requires:       qt5-qtwebkit

BuildArch:      noarch

%description
ReText is a simple but powerful text editor for Markdown and reStructuredText.

%description -l de
ReText ist ein einfacher, aber leistungsfähiger Texteditor
für Markdown und reStructuredText.

%prep
%setup -q -n ReText-%{version}
%patch0

%build
%{__python3} setup.py build

%install
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}

mkdir -p %{buildroot}/%{_mandir}/man1
install -p -m 0644 %SOURCE2 %{buildroot}/%{_mandir}/man1

# Generate and install localized man pages
mkdir -p man/de
po4a-translate -M utf-8 -f man \
               --option groff_code=verbatim \
               -m %SOURCE2 -p %SOURCE1 \
               -l man/de/%{name}.1

mkdir -p %{buildroot}/%{_mandir}/de/man1
install -p -m 0644 man/de/%{name}.1 %{buildroot}/%{_mandir}/de/man1

# Generate resized icons
pushd icons
mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/{16x16,22x22,24x24,32x32,48x48,64x64,72x72,96x96,128x128,scalable}/apps
for s in 16x16 22x22 24x24 32x32 48x48 64x64 72x72 96x96 128x128
do
    convert ./retext.png -resize $s %{buildroot}/%{_datadir}/icons/hicolor/$s/apps/retext.png;
done
install -p -m 0644 retext.svg %{buildroot}/%{_datadir}/icons/hicolor/scalable/apps
popd

desktop-file-install \
--dir=%{buildroot}%{_datadir}/applications \
%{_builddir}/%{srcname}-%{version}/data/*.desktop

%find_lang retext --with-man

%check
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/appdata/*.appdata.xml || :

%if 0%{?with_tests}
%{__python3} setup.py test
%endif # with_tests


%post
/usr/bin/update-desktop-database &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
/usr/bin/update-desktop-database &> /dev/null || :
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files -f retext.lang
%doc changelog.md configuration.md README.md
%license  LICENSE_GPL
%{_bindir}/%{name}
%{_datadir}/appdata/*.appdata.xml
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_datadir}/%{name}/
%{_mandir}/man1/*.1.*
%{python3_sitelib}/%{srcname}/
%{python3_sitelib}/*egg-info

%changelog
* Wed Mar 02 2016 Rex Dieter <rdieter@fedoraproject.org> 5.3.0-4
- Requires: python3-qt5-webkit

* Wed Feb 17 2016 Mario Blättermann <mario.blaettermann@gmail.com> - 5.3.0-3
- Patch for Enchant (RHBZ #1309365)

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sat Jan 23 2016 Mario Blättermann <mario.blaettermann@gmail.com> - 5.3.0-1
- New upstream version

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Nov 05 2015 Mario Blättermann <mario.blaettermann@gmail.com> - 5.2.1-1
- New upstream version
- Removed custom appdata file

* Fri Sep 11 2015 Mario Blättermann <mario.blaettermann@gmail.com> - 5.1.0-1
- New upstream version
- Remove wpgen stuff

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri May 15 2015 Mario Blättermann <mario.blaettermann@gmail.com> - 5.0.2-2
- New upstream version
- Add qt5-qtlocation to runtime requirements (bz #1215369)

* Sat Jan 31 2015 Mario Blättermann <mario.blaettermann@gmail.com> - 5.0.1-7
- Fix file permissions
- Add update-desktop-database scripts
- Fix download location
- Extended description in appdata file, fix license declaration 

* Thu Jan 15 2015 Mario Blättermann <mario.blaettermann@gmail.com> - 5.0.1-6
- Fix URLs of extra sources
- Add appdata file

* Sat Jan 10 2015 Mario Blättermann <mario.blaettermann@gmail.com> - 5.0.1-5
- Replace qt-devel with qt5-qttools-devel to use the correct
  linguist toolchain

* Tue Dec 30 2014 Mario Blättermann <mario.blaettermann@gmail.com> - 5.0.1-4
- Use the %%license macro
- Keep the tests enabled, but make them optional

* Wed Dec 17 2014 Mario Blättermann <mario.blaettermann@gmail.com> - 5.0.1-3
- Add qt-devel to BuildRequires

* Tue Dec 16 2014 Mario Blättermann <mario.blaettermann@gmail.com> - 5.0.1-2
- Add noarch tag

* Mon Dec 01 2014 Mario Blättermann <mario.blaettermann@gmail.com> - 5.0.1-1
- New upstream version
- Man pages from the Debian package
- Install *.desktop file
- Enable tests

* Wed Jan 08 2014 Mario Blättermann <mario.blaettermann@gmail.com> - 4.0.1-2
- Spec file cleanup

* Wed May 08 2013 Huaren Zhong <huaren.zhong@gmail.com> - 4.0.1
- Rebuild for Fedora

* Sat Feb 18 2012 i@marguerite.su
- update to 3.0beta1

* Thu Dec 29 2011 i@marguerite.su
- initial package 2.1.3