bazel-contrib / bazel-contrib/rules_python

pre-compile is failing for binary targets if there is no main specified

Open
#2,881 3 comments 0 reactions 0 assignees View on GitHub
core-rules type: bug
Dominant language
Starlark
Stars
688
Forks
721
Avg merge
14h 49m
Merged PRs (30d)
81

Description

With #2768 optional, it is possible to have zero `.py` files or the `main` is not used or specify `main_module`.

Then I get errors:
```
providers = py_executable_impl(
File "/home/ignas-anikevicius/.cache/bazel/_bazel_ignas-anikevicius/e1764a0ec8835154284d951e9bb11b85/external/rules_python+/python/private/py_executable.bzl", line 256, column 35, in py_executable_impl
return py_executable_base_impl(
File "/home/ignas-anikevicius/.cache/bazel/_bazel_ignas-anikevicius/e1764a0ec8835154284d951e9bb11b85/external/rules_python+/python/private/py_executable.bzl", line 1049, column 50, in py_executable_base_impl
main_py = precompile_result.py_to_pyc_map[main_py]
Error: key None not found in dictionary
```

It seems that we may have forgotten to handle the `main_module` in precompilation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.