-
Notifications
You must be signed in to change notification settings - Fork 273
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
Make sure output directory for actool exists before invoking actool #896
Conversation
bda63b1
to
f248143
Compare
Previously, each "actool" compile action declared an output directory but didn't create it. Instead, it relied on Bazel to create the directory before invoking the tool. With a non-remote spawn strategy, Bazel would implicitly create it for you; but with the remote spawn strategy, it is not created by the remote worker. Additionally, this was also against what was documented for `declare_directory`, which says that "You must create an action that generates the directory". This patches the "actool" wrapper to create an empty directory if one doesn't exist at the specified output path, to make it works with remote execution.
f248143
to
57045bd
Compare
for idx, arg in enumerate(toolargs): | ||
if arg == "--compile": | ||
output_dir = toolargs[idx + 1] | ||
if not os.path.exists(output_dir): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use os.makedirs(output_dir, exist_ok=True)
instead of checking for existence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked that but it's only available on Python ≥ 3.5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh i wish rules_python just bundled real python toolchains...
for idx, arg in enumerate(toolargs): | ||
if arg == "--compile": | ||
output_dir = toolargs[idx + 1] | ||
if not os.path.exists(output_dir): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh i wish rules_python just bundled real python toolchains...
Previously, each "actool" compile action declared an output directory but didn't create it. Instead, it relied on Bazel to create the directory before invoking the tool. With a non-remote spawn strategy, Bazel would implicitly create it for you; but with the remote spawn strategy, it is not created by the remote worker. Additionally, this was also against what was documented for declare_directory, which says that "You must create an action that generates the directory". This patches the "actool" wrapper to create an empty directory if one doesn't exist at the specified output path, to make it works with remote execution. #896 RELNOTES: None PiperOrigin-RevId: 423797086
Previously, each "actool" compile action declared an output directory
but didn't create it. Instead, it relied on Bazel to create the
directory before invoking the tool. With a non-remote spawn strategy,
Bazel would implicitly create it for you; but with the remote spawn
strategy, it is not created by the remote worker.
Additionally, this was also against what was documented for
declare_directory
, which says that "You must create an action thatgenerates the directory".
This patches the "actool" wrapper to create an empty directory if one
doesn't exist at the specified output path, to make it works with remote
execution.
Fixes #861.