Score:0

prevent rpmbuild from changing the shebang when building python packages on RH8

fo flag

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

the shebangs 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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.