Description
When using rules_python 1.7.0+ I am seeing the below import error when building:
ModuleNotFoundError: No module named 'tools.wrapper_common'
Environment
- rules_apple: 4.3.3
- rules_python: 1.7.0 (works with 1.6.3)
- apple_support: 2.0.0
- Bazel: 8.x
- rules_xcodeproj: 3.5.1
Root Cause
rules_python 1.7.0 changed how import paths are handled in PR bazel-contrib/rules_python#3242 - moving from PYTHONPATH environment variable to writing paths to a generated file.
When tree artifact outputs are enabled, bundletool_experimental.py invokes the codesigning tool via os.system():
I think the issue is here, where the python paths no longer are set in a way for importing tools.wrapper_common
Reproduction
- Use rules_python 1.7.0+ with rules_apple 4.3.3
- Build an iOS app with tree artifact outputs enabled (default in rules_xcodeproj)
- The codesigning step fails with the import error
Workarounds
- Downgrade rules_python to 1.6.3 - The import path handling works correctly in 1.6.3
- Disable tree artifact outputs - Add
--define=apple.experimental.tree_artifact_outputs=0 to .bazelrc
Description
When using
rules_python1.7.0+ I am seeing the below import error when building:Environment
Root Cause
rules_python 1.7.0 changed how import paths are handled in PR bazel-contrib/rules_python#3242 - moving from
PYTHONPATHenvironment variable to writing paths to a generated file.When tree artifact outputs are enabled,
bundletool_experimental.pyinvokes the codesigning tool viaos.system():rules_apple/tools/bundletool/bundletool_experimental.py
Line 306 in 9c9f156
I think the issue is here, where the python paths no longer are set in a way for importing
tools.wrapper_commonReproduction
Workarounds
--define=apple.experimental.tree_artifact_outputs=0to.bazelrc