+1 in principle. In practice, I suspect the auditwheel team as it currently stands has enough on their plate just handling Linux, so I expect this will need someone with both the time and the Windows knowledge to step up and offer to help.
I agree that auditwheel would be a good place for this. There’s a lot of logic for scanning and repacking wheel files that could be shared across platforms. And it’s already very challenging for package maintainers to understand all the different platforms well enough to build wheels on all of them. Being able to use the same tool on different platforms will make this a little bit easier.
Scan the wheel to find PE format files (DLLs and EXEs)
For each PE file, extract the list of DLLs that it links to – IIRC machomachomangler can do this, or probably lots of PE libraries can
Compare those to some list of which libraries are built into Windows and don’t need vendoring. This will probably need refinement over time, but you can probably get close by looking at a fresh Windows install. Or maybe Steve Dower can help.
For libraries which do need vendoring, move them into a directory in the wheel, and mangle their names, like how we do on Linux. AFAIK machomachomangler is the only existing tool for this part.
Possibly the most annoying part: windows doesn’t have an equivalent of RPATH. So we need to rewrite the wheel’s top-level __init__.py and inject some code to add our vendored libs dir to the DLL search path. There are a lot of ways to approach this, they’re all kinda gross, but I think we can hold our noses and make it work in practice.
I’m on my phone so can’t easily look up their usernames, but someone should probably CC Matthew Brett and the auditwheel maintainers into this thread.
Hopefully os.add_dll_directory() is the least gross of these I’d be just as happy to see it validate and pass/fail rather than trying to fix anything automatically, though.
As with everyone else, +1 in principle, but not committing my own time to it. I could probably help making a list of the intersection of pre-installed DLLs across clean, supported Windows versions though.