Caution
This API is not finalised, and may change in a patch version.
installer.sources
¶
Source of information about a wheel file.
-
class
installer.sources.
WheelSource
(distribution, version)¶ Represents an installable wheel.
This is an abstract class, whose methods have to be implemented by subclasses.
-
property
dist_info_dir
¶ Name of the dist-info directory.
-
property
data_dir
¶ Name of the data directory.
-
property
dist_info_filenames
¶ Get names of all files in the dist-info directory.
Sample usage/behaviour:
>>> wheel_source.dist_info_filenames ['METADATA', 'WHEEL']
-
read_dist_info
(filename)¶ Get contents, from
filename
in the dist-info directory.Sample usage/behaviour:
>>> wheel_source.read_dist_info("METADATA") ...
- Parameters
filename (FSPath) – name of the file
- Return type
Text
-
get_contents
()¶ Sequential access to all contents of the wheel (including dist-info files).
This method should return an iterable. Each value from the iterable must be a tuple containing 2 elements:
record: 3-value tuple, to pass to
RecordEntry.from_elements
.stream: An
io.BufferedReader
object, providing the contents of the file at the location provided by the first element (path).
All paths must be relative to the root of the wheel.
Sample usage/behaviour:
>>> iterable = wheel_source.get_contents() >>> next(iterable) (('pkg/__init__.py', '', '0'), <...>)
This method may be called multiple times. Each iterable returned must provide the same content upon reading from a specific file’s stream.
- Return type
Iterator[WheelContentElement]
-
property