installer icon indicating copy to clipboard operation
installer copied to clipboard

Expose some helper functions in WheelSource

Open frostming opened this issue 3 years ago • 2 comments

When I extend installer to support custom installation logic, I found the following methods or attributes very useful and worth exposing as a public method:

  1. root_scheme. Currently retrieved by an unexported function _process_WHEEL_file, would be good to make it a property of WheelSource
  2. _determine_scheme(path, source, root_scheme). Currently, it is an unexported function, would be good to make it a method of WheelSource: WheelSource.determine_scheme(path). This, IMO, can achieve high cohesion.

frostming avatar Mar 30 '22 01:03 frostming

What do you want these for?

pradyunsg avatar Mar 30 '22 08:03 pradyunsg

There are several cases:

  1. I want to get the path to dist-info dir to build an importlib.metadata.Distribution. Often it is available by os.path.join(destination.scheme_dict[root_scheme], source.dist_info_dir), where root_scheme is needed.
  2. Pass a file filter to my custom WheelSource, whose signature is def filter(WheelSource, WheelContentElement) -> bool. Inside the filter, we are likely to want to know the scheme the given record entry belongs to, wheredetermine_scheme is needed.

If I am missing something please correct me.

frostming avatar Mar 30 '22 09:03 frostming