Uncategorized

rhel – shebang changed to /usr/libexec/platform-python when building python rpm packages


I am trying to build a RPM from a python application on RHEL8.2 machine.

the shebang on the scripts are set correctly to #!/usr/bin/python3
however for some reason the shebang gets changed to #!/usr/libexec/platform-python -s when the RPM is built.

I have tried almost everything.

I have undefined the mangling according to doc: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/packaging_and_distributing_software/advanced-topics

 %undefine __brp_mangle_shebangs

but the shebangs gets still changed.

this is the relevant parts of the specs file:

%undefine __brp_mangle_shebangs
Name: myapp
Version: 2.0.0
Release: 1%{?dist}
summary: rpm for my APP

BuildArch: noarch

### Build Dependencies ###
BuildRequires: python3-setuptools
BuildRequires: python3-devel

%?python_enable_dependency_generator

%build
%py3_build


%install
%py3_install

%files
....

I can include python*-rpm-macros to the specs and that would set the shebang to something like /usr/bin/python3.6 but it is too restrictive. Our code works in anything > python3.6 so if we deploy the rpm in a system with python3.8 it should work.

how can I set /usr/bin/python3 or leave the shebang unchanged on the python scripts? when the rpm is packaged?



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *