I need to extract a zipfile coming from a `DigestC...
# plugins
b
I need to extract a zipfile coming from a
DigestContents
. Python's
zipflle
seemingly only works on files on disk. Anyone know how to either materialize the
DigestContents
(into a tempdir or something) or parse the zipfile in-memory?
1
f
There are archive extraction rules in Pants.
pants.core.util_rules.archive I think
b
maybe_extract_archive
🤔
Noooo my archive doesn't end in a standard suffix 😭
Although if I was to upstream this I think I could add an input to
maybe_extract_archive
Wait, I can just use the helper rules for my specific case
Nevermind that's just running a process and that's ugly
h
Feel free to refactor the core rules to make this more useful. That is an anti-pattern that you need to rename the file
b
Since the rule doesn't request the file contents, it can only go by pathname. The only way to handle this without asking for contents would be to either have the rule take in what archive type it is or start whitelisting more "known" extensions (in this case
whl
). I think the former
h
Can you have the plug-in author hardcode the value? If not hard coded, then we fall back to our default heuristic?
b
That would be the former, yeah
coke 1
h
Seems like a sensible change to me