Caution
This API is not finalised, and may change in a patch version.
installer.utils
#
Utilities related to handling / interacting with wheel files.
- installer.utils.parse_metadata_file(contents)#
Parse PEP 376
PKG-INFO
-style metadata files.METADATA
andWHEEL
files (as per PEP 427) use the same syntax and can also be parsed using this function.
- installer.utils.parse_wheel_filename(filename)#
Parse a wheel filename, into it’s various components.
- Parameters:
filename (str) – The filename to parse
- Return type:
- installer.utils.copyfileobj_with_hashing(source, dest, hash_algorithm)#
Copy a buffer while computing the content’s hash and size.
Copies the source buffer into the destination buffer while computing the hash of the contents. Adapted from
shutil.copyfileobj
.
- installer.utils.get_launcher_kind()#
Get the launcher kind for the current machine.
- Return type:
LauncherKind
- installer.utils.fix_shebang(stream, interpreter)#
Replace
#!python
shebang in a stream with the correct interpreter.
- installer.utils.construct_record_file(records, prefix_for_scheme=lambda _: ...)#
Construct a RECORD file.
- Parameters:
records (Iterable[Tuple[Scheme, RecordEntry]]) –
records
as passed intoWheelDestination.finalize_installation
prefix_for_scheme (Callable[[Scheme], str | None]) – function to get a prefix to add for RECORD entries, within a scheme
- Returns:
A stream that can be written to file. Must be closed by the caller.
- Return type:
- installer.utils.parse_entrypoints(text)#
Parse
entry_points.txt
-style files.
- installer.utils.make_file_executable(path)#
Make the file at the provided path executable.
- Parameters:
path (str | os.PathLike[str]) –
- Return type:
None
- class installer.utils.WheelFilename#
WheelFilename(distribution, version, build_tag, tag)
- static __new__(_cls, distribution, version, build_tag, tag)#
Create new instance of WheelFilename(distribution, version, build_tag, tag)
- build_tag#
Alias for field number 2
- distribution#
Alias for field number 0
- tag#
Alias for field number 3
- version#
Alias for field number 1