%{!?__python2: %global __python2 %{__python}} %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python2_sitelib: %global python2_sitelib %{python_sitelib}} Name: key-mon Version: 1.18 Release: 0%{?dist}.2sunshine Summary: A screen cast utility that displays your keyboard and mouse status Group: Development/Libraries License: ASL 2.0 URL: https://github.com/critiqjo/key-mon/ Source0: https://github.com/critiqjo/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: desktop-file-utils Requires: pygtk2 %if 0%{?fedora} > 12 || 0%{?rhel} > 7 Requires: python2-xlib %else Requires: python-xlib %endif Requires: librsvg2 %description Key-mon is useful for teaching since it shows the current status of your keyboard and mouse and you use them in another application. No longer do you need to say 'Now I'm pressing the Ctrl-D key', your students can just see the keystroke for themselves. %prep %setup -q rm src/keymon/themes/clear/config~ #remove hashbang python line from library python files for lib in src/keymon/*.py; do sed '1{\@^#!/usr/bin/python@d}' $lib > $lib.new && touch -r $lib $lib.new && mv $lib.new $lib done #make key-mon explicitly call python2 #sed '1d' src/key-mon > src/key-mon.bak #echo "#!%{__python2}" > src/key-mon #cat src/key-mon.bak >> src/key-mon #rm src/key-mon.bak %build %{__python2} setup.py build %install %{__python2} setup.py install -O1 --skip-build --root=%{buildroot} desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications icons/%{name}.desktop rm -rf %{buildroot}%{_datadir}/icons/hicolor mkdir -p %{buildroot}%{_datadir}/icons/hicolor pushd icons/hicolor for d in *; do mkdir -p %{buildroot}%{_datadir}/icons/hicolor/"$d"/apps install -p -m 0644 "$d"/apps/* %{buildroot}%{_datadir}/icons/hicolor/"$d"/apps/ done %post touch --no-create %{_datadir}/icons/hicolor if [ -x %{_bindir}/gtk-update-icon-cache ]; then %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : fi update-desktop-database &> /dev/null || : %postun touch --no-create %{_datadir}/icons/hicolor if [ -x %{_bindir}/gtk-update-icon-cache ]; then %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : fi update-desktop-database &> /dev/null || : %files %{!?_licensedir:%global license %%doc} %doc README.rst ACKNOWLEDGMENTS.rst %license COPYING %{_bindir}/%{name} %{_datadir}/pixmaps/%{name}.xpm %{_datadir}/icons/hicolor/*/apps/%{name}* %{_datadir}/applications/%{name}.desktop %{python2_sitelib}/keymon/ %{python2_sitelib}/key_mon-%{version}* %changelog * Wed Jan 15 2020 Moritz Barsnick 1.18-0.2sunshine - conditionally force python2 for BR python(2)-xlib * Sat Jul 29 2017 Moritz Barsnick 1.18-0.1sunshine - update to 1.18 - new Source0 and URL - use %%license tag where available - add ACKNOWLEDGMENTS.rst to %%doc - drop the man pages, they're not useful anyway * Mon Aug 11 2014 Moritz Barsnick 1.17-0.1sunshine - update to 1.17 - package new hicolor icons - get Source0 from Google Code (it's not on PyPi yet) - provide Python macros for older Fedoras * Sun Jun 08 2014 Fedora Release Engineering - 1.16-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Fri Dec 06 2013 Ryan Lerch 1.16-1 - initial package for Fedora