File inkscape-extension-pages.spec of Package inkscape-extension-pages

%define debug_package %{nil}
# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')

Name:      inkscape-extension-pages
License:   GPL v2 or later  
Group:     Applications/Multimedia
Version:   1.2.1
Release:   2
Summary:   Inkscape multiple pages support
URL:       http://sourceforge.net/projects/inkscape-pages
Source0:   inkscape-pages-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build  
BuildRequires: perl-Parse-Yapp perl-Tk-GraphViz
Requires:      inkscape pdftk

%description  
Inkscape has now pages support. You can create a multiple page document using Inkscape, just like in Corel Draw. Install this extension, restart Inkscape and you're done. Insert new pages, navigate through pages, print all pages in a single PDF.

%prep
%setup -q -n inkscape-pages-%{version}

%build
rm -rf %{buildroot}

%install
mkdir -p %{buildroot}%{_datadir}/inkscape/extensions
install -D -m 0644 modules/*.py %{buildroot}%{_datadir}/inkscape/extensions
install -D -m 0644 modules/en/* %{buildroot}%{_datadir}/inkscape/extensions
install -D -m 0755 install_shortcuts.py %{buildroot}%{_datadir}/inkscape/extensions/install_shortcuts.py
install -D -m 0644 keys.xml %{buildroot}%{_datadir}/inkscape/extensions/keys.xml

# make list of installed files
find %{buildroot} -type f > INSTALLED_FILES
perl -pi -w -e 's|%{buildroot}||g;' INSTALLED_FILES

%preun
# dont run scripts on update
if [ ${1:-0} -lt 2 ]; then
perl -pi -w -e 's|<bind key="Page_Up" modifiers="Ctrl" action="org.greygreen.inkscape.effects.pages_go_previous" display="true"/>||g;' %{_datadir}/inkscape/extensions/default.xml
perl -pi -w -e 's|<bind key="Page_Down" modifiers="Ctrl" action="org.greygreen.inkscape.effects.pages_go_next" display="true"/>||g;' %{_datadir}/inkscape/extensions/default.xml
perl -pi -w -e 's|<bind key="Page_Down" modifiers="Ctrl,Alt" action="org.greygreen.inkscape.effects.pages_go_last" display="true"/>||g;' %{_datadir}/inkscape/extensions/default.xml
perl -pi -w -e 's|<bind key="Page_Up" modifiers="Ctrl,Alt" action="org.greygreen.inkscape.effects.pages_go_first" display="true"/>||g;' %{_datadir}/inkscape/extensions/default.xml
perl -pi -w -e 's|<bind key="Insert" modifiers="Ctrl,Alt,Shift" action="org.greygreen.inkscape.effects.pages_insert_normal" display="true"/>||g;' %{_datadir}/inkscape/extensions/default.xml
fi

%post
# dont run scripts on update
if [ ${1:-0} -lt 2 ]; then
python %{_datadir}/inkscape/extensions/install_shortcuts.py -i %{_datadir}/inkscape/extensions/keys.xml -o %{_datadir}/inkscape/keys/default.xml
fi
rm -rf %{_datadir}/inkscape/extensions/install_shortcuts.py %{_datadir}/inkscape/extensions/keys.xml

%clean
rm -rf %{buildroot}  

%files -f INSTALLED_FILES
%defattr(-,root,root)
%doc README

%changelog
* Thu Aug 29 2013 Muhammad Shaban <mr.Muhammad@linuxac.org> - 1.2.1-2
- rewrite spec file

* Mon Jun 04 2012 Muhammad Shaban <mr.Muhammad@linuxac.org> - 1.2.1-1
- update

* Tue Nov 22 2011 Muhammad Shaban <Mr.Muhammad@linuxac.org> - 1.2-1
- Initial release 1.2