Skip to content

Commit 6789c47

Browse files
committed
nfpm.native_libs.deb: add usage comments
1 parent 139e595 commit 6789c47

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/python/pants/backend/nfpm/native_libs/deb/search_for_sonames.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Copyright 2025 Pants project contributors (see CONTRIBUTORS.md).
22
# Licensed under the Apache License, Version 2.0 (see LICENSE).
33

4+
"""A standalone script that uses asyncio to find packages that contain a SONAME.
5+
6+
Rule code should run this script as a subprocess in a sandboxed venv. Generally, that venv should
7+
be a subset of the pants venv (using the version of packages that pants depends on).
8+
9+
WARNING: This script relies on aiohttp and asyncio, so their are probably incompatibilities
10+
with rule code in the pants engine. So, avoid importing this script in rule code.
11+
"""
12+
413
from __future__ import annotations
514

615
import argparse

src/python/pants/backend/nfpm/native_libs/deb/search_for_sonames_integration_test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@
88

99
import pytest
1010

11+
from pants.backend.nfpm.native_libs.deb.rules import (
12+
DebPackagesForSonames,
13+
DebSearchForSonamesRequest,
14+
)
15+
from pants.backend.nfpm.native_libs.deb.rules import rules as native_libs_deb_rules
1116
from pants.backend.python.util_rules import pex_from_targets
1217
from pants.engine.rules import QueryRule
1318
from pants.testutil.rule_runner import RuleRunner
1419

15-
from .rules import DebPackagesForSonames, DebSearchForSonamesRequest
16-
from .rules import rules as native_libs_deb_rules
20+
# The relative import emphasizes that `search_for_sonames` is a standalone script that runs
21+
# from a sandbox root (thus avoiding a dependency on the pants code structure).
1722
from .search_for_sonames import deb_search_for_sonames
1823

1924
_libldap_soname = "libldap-2.5.so.0"

src/python/pants/backend/nfpm/native_libs/deb/search_for_sonames_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
from __future__ import annotations
55

6+
# The relative import emphasizes that `search_for_sonames` is a standalone script that runs
7+
# from a sandbox root (thus avoiding a dependency on the pants code structure).
68
from .search_for_sonames import deb_packages_from_html_response
79

810
# simplified for readability and to keep it focused

0 commit comments

Comments
 (0)