diff options
author | Matthew Sotoudeh <masotoudeh@ucdavis.edu> | 2020-09-01 14:06:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 14:06:46 -0700 |
commit | 938df280646d1dc4e50c17f8949f5c247597e125 (patch) | |
tree | 5b52c9f7a239a9a1520e48f4c9d42330b3fc6dd9 | |
parent | e8207c27a2dbbed1f0a013717b32242478349d90 (diff) |
Escape arguments to the coverage script (#9)
We pass to the coverage report-generating script strings which specify where to find certain source files. We want to support providing multiple such files, hence we want each argument to include spaces. I thought it would be enough to just pass them as two separate arguments in the sh_binary rule, but it seems it's necessary to actually escape the spaces. This PR addresses that.
-rw-r--r-- | bazel_python.bzl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bazel_python.bzl b/bazel_python.bzl index cd0bdd1..44f9fea 100644 --- a/bazel_python.bzl +++ b/bazel_python.bzl @@ -135,13 +135,15 @@ def bazel_python_coverage_report(name, test_paths, code_paths): test_paths = " ".join([ "bazel-out/*/testlogs/" + test_path + "/test.outputs/outputs.zip" for test_path in test_paths]) - code_paths = " ".join([code_path for code_path in code_paths]) + code_paths = " ".join(code_paths) + if "'" in test_paths or "'" in code_paths: + fail("Quotation marks in paths names not yet supported.") # For generating the coverage report. native.sh_binary( name = name, srcs = ["@bazel_python//:coverage_report.sh"], deps = [":_dummy_coverage_report"], - args = [test_paths, code_paths], + args = ["'" + test_paths + "'", "'" + code_paths + "'"], ) # This is only to get bazel_python_venv as a data dependency for |