Skip to content

codesigningtool fails with rules_python 1.7.0 when using tree artifact outputs #2843

@vincehodsdon

Description

@vincehodsdon

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

  1. Use rules_python 1.7.0+ with rules_apple 4.3.3
  2. Build an iOS app with tree artifact outputs enabled (default in rules_xcodeproj)
  3. The codesigning step fails with the import error

Workarounds

  1. Downgrade rules_python to 1.6.3 - The import path handling works correctly in 1.6.3
  2. Disable tree artifact outputs - Add --define=apple.experimental.tree_artifact_outputs=0 to .bazelrc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions