| # Copyright 2026 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| load("@rules_license//rules:license.bzl", "license") | |
| load("@rules_python//python:py_library.bzl", "py_library") | |
| load("//build/bazel/platforms:constraints.bzl", "HOST_OS_CONSTRAINTS") | |
| package(default_applicable_licenses = [":license"]) | |
| # Bazel-only package license metadata. | |
| # @bazel2gn:skip | |
| license( | |
| name = "license", | |
| license_kinds = ["@rules_license//licenses/spdx:Apache-2.0"], | |
| license_text = "src/LICENSE", | |
| ) | |
| # GN python_library specifies enable_mypy and source_root. | |
| # TODO(https://fxbug.dev/570694755): Verify whether portpicker should use target_compatible_with (was not gated by if (is_host) in GN). | |
| # @bazel2gn:raw_attribute:enable_mypy = false | |
| # @bazel2gn:raw_attribute:source_root = "src/src" | |
| py_library( | |
| name = "portpicker", | |
| srcs = [ | |
| # GN python_library resolves sources relative to source_root ("src/src"). | |
| "src/src/portpicker.py", # @bazel2gn:path_overwrite:portpicker.py | |
| # GN python_library resolves sources relative to source_root ("src/src"). | |
| "src/src/portserver.py", # @bazel2gn:path_overwrite:portserver.py | |
| ], | |
| imports = ["src/src"], | |
| target_compatible_with = HOST_OS_CONSTRAINTS, | |
| visibility = [ | |
| "//scripts/debug/zxdb_cli/daemon:__pkg__", | |
| "//scripts/debug/zxdb_cli/tests:__pkg__", | |
| "//scripts/fxtest/python:__pkg__", | |
| "//src/developer/debug/e2e_tests/dap_integration_tests:__pkg__", | |
| "//third_party/mobly:__pkg__", | |
| ], | |
| ) |