Closed cjntaylor closed 4 months ago
I've updated this PR to reflect changes in the most recent release to use the resource name instead of the path name.
Using path.name
as in the original implementation defeats the purpose of using the importlib.resources
api. The documentation specifically calls out that the as_file
method (and it's predecessors) are allowed to materialize the requested file(s) in a temporary location with arbitrary names. The code only works as written because under normal circumstances, the shiv
module is already unpacked and the files are just referred to directly.
The whole point of this API is that you're not supposed to assume the latter behaviour. This breaks down in cases where the module isn't unpacked (shiv itself is in a zip file, or embedded in something like pyoxidizer). A name property is specifically provided that doesn't make this assumption and works in both cases.
Please consider pulling in this change. I'm happy to make any alterations you'd like, or even to iterate with you on other approaches. I'd really like to be able to use shiv without needing to maintain my own fork 😉
Hi @cjntaylor, Thanks so much for your contribution and especially for your patience 😓
Fixes #247