"Installed but unpackaged files found" when trying to use the new Python Packaging Guidelines macros

I’m trying to create a spec file following the new python packaging guidelines and I’m having a problem with “installed but unpackaged” files:

Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/leug/rpmbuild/BUILDROOT/python-liblarch-3.1.0-1.fc34.x86_64
error: Installed (but unpackaged) file(s) found:
   /usr/lib/python3.9/site-packages/liblarch_gtk/__init__.py
   /usr/lib/python3.9/site-packages/liblarch_gtk/__pycache__/__init__.cpython-39.opt-1.pyc
   /usr/lib/python3.9/site-packages/liblarch_gtk/__pycache__/__init__.cpython-39.pyc
   /usr/lib/python3.9/site-packages/liblarch_gtk/__pycache__/treemodel.cpython-39.opt-1.pyc
   /usr/lib/python3.9/site-packages/liblarch_gtk/__pycache__/treemodel.cpython-39.pyc
   /usr/lib/python3.9/site-packages/liblarch_gtk/treemodel.py


RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/lib/python3.9/site-packages/liblarch_gtk/__init__.py
   /usr/lib/python3.9/site-packages/liblarch_gtk/__pycache__/__init__.cpython-39.opt-1.pyc
   /usr/lib/python3.9/site-packages/liblarch_gtk/__pycache__/__init__.cpython-39.pyc
   /usr/lib/python3.9/site-packages/liblarch_gtk/__pycache__/treemodel.cpython-39.opt-1.pyc
   /usr/lib/python3.9/site-packages/liblarch_gtk/__pycache__/treemodel.cpython-39.pyc
   /usr/lib/python3.9/site-packages/liblarch_gtk/treemodel.py

This is my spec file:

Name:           python-liblarch
Version:        3.1.0
Release:        1%{?dist}
Summary:        Data structures helper library for python

License:        LGPL-3.0-or-later
URL:            https://wiki.gnome.org/Projects/liblarch
Source0:        https://github.com/getting-things-gnome/liblarch/archive/refs/tags/v%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python3-devel

%global _description %{expand:
Liblarch is a python library built to easily handle data structure such as\
lists, trees and directed acyclic graphs.}

%description %_description

%package -n python3-liblarch
Summary:        %{summary}
Requires:       python3-gobject

%description -n python3-liblarch %_description

%package -n python3-liblarch_gtk
Summary:        Liblarch gtk binding for use in Gtk.Treeview
Requires:       python3-liblarch

%description -n python3-liblarch_gtk
liblarch_gtk is a liblarch binding that will allow you to use your
data structure into a Gtk.Treeview.


%prep
%autosetup -n liblarch-%{version}
sed -i "1c#!%{_bindir}/python3" ./examples/contact_list/contact_list.py

%generate_buildrequires
%pyproject_buildrequires -r

%build
%pyproject_wheel

%install
%pyproject_install

%pyproject_save_files liblarch


#check
#pytest


%files -n python3-liblarch -f %{pyproject_files}
%license LICENSE
%doc AUTHORS README.md examples

%files -n python3-liblarch_gtk -f %{pyproject_files}
%license LICENSE
%doc AUTHORS README.md

%changelog
* Thu Aug 26 2021 Miguel Reis de Araújo <reisaraujo.miguel@gmail.com> - 3.0.1-1
- New upstream release 3.0.1

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.0-3
- Rebuilt for Python 3.7

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Nov 16 2017 Jan Beran <jberan@redhat.com> - 3.0 - 1
- New version in Python 3

* Tue Aug 29 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.1.0-12
- Fix python2 subpackage naming

* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.1.0-11
- Python 2 binary package renamed to python2-liblarch
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.0-8
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

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

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

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Thu Jan  9 2014 Yanko Kaneti <yaneti@declera.com> - 2.1.0-4
- Upstream moved to github and added examples and tests to the tarball

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Nov  9 2012 Yanko Kaneti <yaneti@declera.com> - 2.1.0-1
- New upstream release - 2.1.0. 
- Upstream merged python-liblarch_gtk - still package separately for now

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Mar  6 2012 Yanko Kaneti <yaneti@declera.com> - 0.1.0-2
- Address review. BR python2-devel. No sitelib definition.
1 Like

Take a look here for the complete usage documentation:

https://src.fedoraproject.org/rpms/pyproject-rpm-macros

Since it’s providing two modules: liblarch and liblarch_gtk, you’d use something like this:

%pyproject_save_files liblarch liblarch_gtk
1 Like

Thanks. This solved the problem.

1 Like