diff --git a/python-rpm-generators.spec b/python-rpm-generators.spec index 580eb06..8f0a75b 100644 --- a/python-rpm-generators.spec +++ b/python-rpm-generators.spec @@ -1,7 +1,7 @@ Name: python-rpm-generators Summary: Dependency generators for Python RPMs Version: 14 -Release: 3%{?dist} +Release: 4%{?dist} # Originally all those files were part of RPM, so license is kept here License: GPLv2+ @@ -47,6 +47,9 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} *.py %{_rpmconfigdir}/pythonbundles.py %changelog +* Mon Apr 17 2023 Kalev Lember - 14-4 +- Generate provides for /app-installed flatpak builds + * Tue Mar 07 2023 Miro HronĨok - 14-3 - Avoid needless pkg_resources import in pythonbundles.py - Ignore environment markers in pythonbundles.py diff --git a/python.attr b/python.attr index 1793d3c..cf5ae39 100644 --- a/python.attr +++ b/python.attr @@ -5,8 +5,10 @@ -- python(abi) = MAJOR.MINOR -- (Don't match against -config tools e.g. /usr/bin/python2.6-config) local path = rpm.expand('%1') - if path:match('/usr/bin/python%d+%.%d+$') then - local provides = path:gsub('.*/usr/bin/python(%d+%.%d+)', 'python(abi) = %1') + -- Use /usr prefix by default, and /app for flatpak builds + local prefix = rpm.expand('%{?!flatpak:/usr}%{?flatpak:/app}') + if path:match(prefix .. '/bin/python%d+%.%d+$') then + local provides = path:gsub('.*' .. prefix .. '/bin/python(%d+%.%d+)', 'python(abi) = %1') print(provides) end } @@ -18,10 +20,12 @@ -- generating a line of the form: -- python(abi) = MAJOR.MINOR local path = rpm.expand('%1') - if path:match('/usr/lib%d*/python%d+%.%d+/.*') then - local requires = path:gsub('.*/usr/lib%d*/python(%d+%.%d+)/.*', 'python(abi) = %1') + -- Use /usr prefix by default, and /app for flatpak builds + local prefix = rpm.expand('%{?!flatpak:/usr}%{?flatpak:/app}') + if path:match(prefix .. '/lib%d*/python%d+%.%d+/.*') then + local requires = path:gsub('.*' .. prefix .. '/lib%d*/python(%d+%.%d+)/.*', 'python(abi) = %1') print(requires) end } -%__python_path ^((%{_prefix}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$ +%__python_path ^((%{?!flatpak:/usr}%{?flatpak:/app}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$ diff --git a/pythondist.attr b/pythondist.attr index 42ae7ad..ede3a51 100644 --- a/pythondist.attr +++ b/pythondist.attr @@ -1,3 +1,3 @@ %__pythondist_provides %{_rpmconfigdir}/pythondistdeps.py --provides --normalized-names-format pep503 --package-name %{name} --majorver-provides-versions %{__default_python3_version} %{?!_python_dist_allow_version_zero:--fail-if-zero} %__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires --normalized-names-format pep503 --package-name %{name} %{?!_python_no_extras_requires:--require-extras-subpackages} --console-scripts-nodep-setuptools-since 3.10 -%__pythondist_path ^/usr/lib(64)?/python[3-9]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$ +%__pythondist_path ^%{?!flatpak:/usr}%{?flatpak:/app}/lib(64)?/python[3-9]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$