Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose some helper functions in WheelSource #116

Open
frostming opened this issue Mar 30, 2022 · 2 comments
Open

Expose some helper functions in WheelSource #116

frostming opened this issue Mar 30, 2022 · 2 comments
Labels
component: sources Related to WheelSource and friends type: feature A self-contained enhancement or new feature

Comments

@frostming
Copy link
Contributor

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.
@pradyunsg
Copy link
Member

What do you want these for?

@frostming
Copy link
Contributor Author

frostming commented Mar 30, 2022

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.

@pradyunsg pradyunsg added the type: feature A self-contained enhancement or new feature label Apr 1, 2022
@pradyunsg pradyunsg added the component: sources Related to WheelSource and friends label Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: sources Related to WheelSource and friends type: feature A self-contained enhancement or new feature
Projects
None yet
Development

No branches or pull requests

2 participants