Add INSTALLER file to install-wheel-rs (#760)

See:
https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-installer-file
This commit is contained in:
Charlie Marsh 2024-01-03 18:30:54 -04:00 committed by GitHub
parent c9f43e915c
commit 02b157085e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 0 deletions

View file

@ -28,6 +28,7 @@ pub fn install_wheel(
location: &InstallLocation<impl AsRef<Path>>,
wheel: impl AsRef<Path>,
direct_url: Option<&DirectUrl>,
installer: Option<&str>,
link_mode: LinkMode,
) -> Result<(), Error> {
let root = location.venv_root();
@ -112,6 +113,7 @@ pub fn install_wheel(
&dist_info_prefix,
true,
direct_url,
installer,
&mut record,
)?;

View file

@ -66,6 +66,7 @@ fn main() -> Result<(), Error> {
File::open(wheel)?,
&filename,
None,
None,
args.compile,
!args.skip_hashes,
&[],

View file

@ -63,6 +63,7 @@ impl LockedVenv {
File::open(wheel)?,
&filename,
None,
None,
true,
true,
&[],

View file

@ -819,6 +819,7 @@ pub(crate) fn extra_dist_info(
dist_info_prefix: &str,
requested: bool,
direct_url: Option<&DirectUrl>,
installer: Option<&str>,
record: &mut Vec<RecordEntry>,
) -> Result<(), Error> {
let dist_info_dir = PathBuf::from(format!("{dist_info_prefix}.dist-info"));
@ -839,6 +840,14 @@ pub(crate) fn extra_dist_info(
record,
)?;
}
if let Some(installer) = installer {
write_file_recorded(
site_packages,
&dist_info_dir.join("INSTALLER"),
installer,
record,
)?;
}
Ok(())
}
@ -900,6 +909,7 @@ pub fn install_wheel(
reader: impl Read + Seek,
filename: &WheelFilename,
direct_url: Option<&DirectUrl>,
installer: Option<&str>,
compile: bool,
check_hashes: bool,
// initially used to the console scripts, currently unused. Keeping it because we likely need
@ -1022,6 +1032,7 @@ pub fn install_wheel(
&dist_info_prefix,
true,
direct_url,
installer,
&mut record,
)?;

View file

@ -53,6 +53,7 @@ impl<'a> Installer<'a> {
.map(pypi_types::DirectUrl::try_from)
.transpose()?
.as_ref(),
Some("puffin"),
self.link_mode,
)
.with_context(|| format!("Failed to install: {} ({wheel})", wheel.filename()))?;