blob: c4f6576bdba87ba0e89d052e18f681ef6d9f10f6 [file] [edit]
#!/usr/bin/env python3
# Copyright (C) 2026 Igalia S.L.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Bridge invoked by the Perl-side wrapper scripts (build-webkit,
# run-javascriptcore-tests, ...) so they share the single Python implementation
# of `maybe_enter_webkit_container_sdk`.
#
# Usage: container-sdk-autoenter <host_command> [args...]
#
# When the Python logic decides to re-execute inside the container, this
# process becomes `podman exec ...` and never returns. Otherwise it exits with
# AUTOENTER_DECLINED_EXIT_CODE, which the Perl caller interprets as
# "continue on the host".
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
from webkitpy.port.linux_container_sdk_utils import (
AUTOENTER_DECLINED_EXIT_CODE,
maybe_enter_webkit_container_sdk,
)
if len(sys.argv) < 2:
sys.exit("Usage: container-sdk-autoenter <host_command> [args...]")
maybe_enter_webkit_container_sdk(argv=sys.argv[1:])
sys.exit(AUTOENTER_DECLINED_EXIT_CODE)