RFE: Allow to --set-installer for custom INSTALLER value
See original GitHub issueWhat’s the problem this feature will solve?
In Fedora, we use pip
to install wheels during the build of RPM packages.
We then replace pip
with rpm
in the INSTALLER
file to indicate: This package has been actually installed trough rpm
on the user systems (despite it being installed by pip
in the build system).
The hash of the INSTALLER
file is recorded in RECORD
. When we change the value, we should also recalculate the hash and adjust RECORD
.
This is getting fragile. I’d rather tell pip
to put arbitrary value to INSTALLER
than sed
it afterwards.
Describe the solution you’d like
We’d like to have --set-installer
option (or --installer
etc.) for pip install
that we would use like this:
pip install --set-installer=rpm ...
It would put the value (rpm
in the example) to INSTALLER
instead of pip
and would put the correct hash to RECORD
.
Alternative Solutions
The alternate solution is what we use now + sed
-ing the hash:
pip install ...
sed -i s/pip/rpm/ ...dist-info/INSTALLER
sed -iE 's|(\.dist-info/INSTALLER,sha256=)[^,]+,|\1'$(sha256sum ...dist-info/INSTALLER | cut -f1 -d" ")',|' ...dist-info/RECORD
Additional context
https://discuss.python.org/t/pep-610-usage-guidelines-for-linux-distributions/4012/17
I’m happy to submit a PR for this if agreed upon.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
That’s what I imagine https://github.com/pradyunsg/installer would become eventually.
See https://github.com/pradyunsg/installer/issues/1 for context.
I’d still like this feature, but I have realized our RECORD file is a mess anyway, so I’ll dig deeper into what needs to be done on our side to prevent that.
I plan to look closer and we might very well just need to recalculate all hashes, drop all hashes or make RECORD optional for packages managed by external tools. When we go that way, setting installer via
sed
will be sufficient for us.Can we keep this open for couple weeks and I’ll get back with more info?