%if 0%{!?mkrel:1} %define mkrel(c) %{1}%{?dist} %endif %if 0%{!?pyproject_wheel:1} %define pyproject_wheel pyproject-build -nwx %endif %if 0%{!?pyproject_install:1} %define pyproject_install pip install --disable-pip-version-check --ignore-installed --no-deps --prefix=%{buildroot}%{_prefix} . %endif %global appid io.sourceforge.obmenu Name: obmenu Version: 1.1.2 Release: %mkrel 1 License: GPL-2.0-Only Summary: A menu editor for Openbox URL: http://obmenu.sourceforge.net Source0: https://github.com/keithbowes/obmenu/archive/refs/tags/1.1.2.tar.gz#/%{name}-%{version}.tar.gz BuildArch: noarch BuildRequires: python BuildRequires: python3dist(pip) BuildRequires: python3dist(setuptools) BuildRequires: python3dist(wheel) BuildRequires: pkgconfig(glib-2.0) Requires: python Requires: python3dist(gobject) Requires: pkgconfig(glib-2.0) # GTK 4 is currently experimental and has to be enabled manually. # It will be the only compatible version in the future. Requires: (pkgconfig(gtk+-3.0) or pkgconfig(gtk-4)) %if 0%{?pyproject_buildrequires:1} %generate_buildrequires %pyproject_buildrequires %else BuildRequires: python3dist(build) %endif %description Obmenu is a menu editor for Openbox and Wayland Openbox clones (like Waybox and LabWC) written in Python. It allows you to edit menus in an intuitive way. %prep %autosetup -p1 %build # Hack until the next version is released with support for DESTDIR sed -i -e 's/\$(PREFIX)/\$(DESTDIR)\$(PREFIX)/g' -e 's/\(schemadir=\)/\1\$(DESTDIR)\//g' Makefile echo "Type=Application" >> %{appid}.desktop sed -i -e 's/^Categories=.*$/Categories=Settings/' %{appid}.desktop %if 0%{?py3_shebang_fix:1} %py3_shebang_fix obmenu pipes/obm-* %endif # The next version will use make_build/make_install and require python3dist(build); # this version still uses ./setup.py build/install in the Makefile. %pyproject_wheel %make_build -C po %install %pyproject_install %make_build install-desktop PREFIX=%{buildroot}%{_prefix} %make_build install-schema DESTDIR=%{buildroot} %make_build -C po install PREFIX=%{buildroot}%{_prefix} %if 0%{?py3_shebang_fix:1} %py3_shebang_fix %{buildroot}%{_bindir}/* %endif %find_lang %{name} %clean rm -f %{_builddir}/%{name}-%{version}*pyproject* rm -rf %{_buildir}/.pyproject-builddir rm -rf %{buildroot} %post glib-compile-schema %{_datadir}/glib-2.0/schemas %postun glib-compile-schema %{_datadir}/glib-2.0/schemas %files -f %{name}.lang %{_bindir}/* %{_datadir}/applications/%{appid}.desktop %{_datadir}/glib-2.0/schemas/%{appid}.gschema.xml %{_datadir}/%{name}/ %{python3_sitelib}/obxml.py %{python3_sitelib}/Obmenu*/ %exclude %{_datadir}/glib-2.0/schemas/gschemas.compiled %{python3_sitelib}/__pycache__/