-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
Support 'file' scheme for external tool downloads #11295
Comments
We should absolutely do this: thanks for the report! Aside from adjusting validation, I believe that the implementation would look like adding a conditional to the body of the rule that fetches the tool: pants/src/python/pants/core/util_rules/external_tool.py Lines 244 to 246 in bc31814
await Get(Digest, DownloadFile(..)) , or await Get(Snapshot, PathGlobs([f'{relative_file_path}'])) (and then validate that the Snapshot captured a single file). This would have some downsides though: it would only support relative file URLs, and it would not be able to validate the file digest (currently).
A better implementation though might be to adjust the rust code to support both schemes: pants/src/rust/engine/src/nodes.rs Lines 734 to 749 in bc31814
Digest to validate, we know that we do not need to "watch" the file path, and can simply use rust's file API to capture it.
|
That could be a frustrating limitation that the file must be relative to the build root. Often, binaries like scc are installed in a more global location. Instead, I suspect we'll want to add back proper support for PathGlobsAndRoot - I think there's an issue tracking it, as we need the functionality already and hack around it by cheating with Path(). |
@Eric-Arellano : Had the same thoughts. Updated my comment. |
If the file: support required size and hash just like the https?: support then there would be no need for path globs, etc - right? In fact, if reqwest supported file: urls then this would all just work. |
Beyond how to specify the "URL", another complication is what that URL can point to. Atm, users have no way to change the I think the solution is simple: add |
Yep, exactly. I had updated my comment to reflect that. I expect that doing this directly in the |
@gatesn let me know if you'd be interested in adding this change, and I'd be happy to write up some instructions. With that added, the only blocker is the Rust changes Stu is mentioning. If not, I'll try to add it late next week. |
Does rust not support opening arbitrary URLs? E.g. Java and Python allow globally registering support for a scheme. urllib.open for instance works with http or file, and probably a bunch of other things. |
We use the Reqwest library and it does not. A feature request is outstanding though: seanmonstar/reqwest#178 |
Fixes pantsbuild#11295 # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
Fixes pantsbuild#11295 # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
It would be great if this worked, so I could pull these tools off a shared filesystem.
The text was updated successfully, but these errors were encountered: