bazel-contrib / bazel-contrib/rules_python

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

Offen
#2,881 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
core-rules type: bug
Vorherrschende Sprache
Starlark
Sterne
688
Forks
721
Ø Merge
15 Std. 7 Min.
Gemergte PRs (30 T.)
76

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start in python/private/py_executable.bzl around py_executable_impl and py_executable_base_impl, especially the precompilation lookup at line 1049. Reproduce a binary target with no .py files, no main, or main_module specified, then verify that precompilation handles the selected entry point without looking up None in py_to_pyc_map.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.