• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 20632486505

01 Jan 2026 04:21AM UTC coverage: 43.231% (-37.1%) from 80.281%
20632486505

Pull #22962

github

web-flow
Merge 08d5c63b0 into f52ab6675
Pull Request #22962: Bump the gha-deps group across 1 directory with 6 updates

26122 of 60424 relevant lines covered (43.23%)

0.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/python/pants/backend/nfpm/native_libs/elfdeps/subsystem.py
1
# Copyright 2025 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
×
5

6
from collections.abc import Iterable
×
7
from dataclasses import dataclass
×
8
from pathlib import PurePath
×
9

10
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
×
11
from pants.backend.python.target_types import ConsoleScript, EntryPoint
×
12
from pants.backend.python.util_rules.pex import VenvPex, create_venv_pex
×
13
from pants.engine.fs import CreateDigest, FileContent
×
14
from pants.engine.intrinsics import create_digest
×
15
from pants.engine.rules import Rule, collect_rules, implicitly, rule
×
16
from pants.util.logging import LogLevel
×
17
from pants.util.resources import read_resource
×
18
from pants.util.strutil import help_text
×
19

20
_ELFDEPS_PACKAGE = "pants.backend.nfpm.native_libs.elfdeps"
×
21
_ANALYZE_SCRIPT = "analyze.py"
×
22
_ANALYZE_TOOL = "__pants_elfdeps_analyze.py"
×
23

24

25
class Elfdeps(PythonToolBase):
×
26
    options_scope = "elfdeps"
×
27
    help_short = help_text(
×
28
        """
29
        Used to analyze ELF binaries.
30

31
        Both elfdeps and pyelftools (used by elfdeps) are pure-python libraries,
32
        so this should be portable across platforms.
33
        """
34
    )
35

36
    default_main = ConsoleScript("elfdeps")
×
37
    default_requirements = ["elfdeps>=0.2.0"]
×
38

39
    default_interpreter_constraints = ["CPython>=3.10,<3.15"]
×
40
    register_interpreter_constraints = True
×
41

42
    default_lockfile_resource = (_ELFDEPS_PACKAGE, "elfdeps.lock")
×
43

44

45
@dataclass(frozen=True)
×
46
class ElfdepsAnalyzeWheelsTool:
×
47
    pex: VenvPex
×
48

49

50
@rule(desc=f"Setup elfdeps/{_ANALYZE_SCRIPT}", level=LogLevel.DEBUG)
×
51
async def setup_elfdeps_analyze_tool(
×
52
    _elfdeps: Elfdeps,
53
) -> ElfdepsAnalyzeWheelsTool:
54
    analyze_script = read_resource(_ELFDEPS_PACKAGE, _ANALYZE_SCRIPT)
×
55
    if not analyze_script:
×
56
        raise ValueError(f"Unable to find source of {_ANALYZE_SCRIPT!r} in {_ELFDEPS_PACKAGE}")
×
57

58
    analyze_script_content = FileContent(
×
59
        path=_ANALYZE_TOOL, content=analyze_script, is_executable=True
60
    )
61
    analyze_script_digest = await create_digest(CreateDigest([analyze_script_content]))
×
62

63
    analyze_pex = await create_venv_pex(
×
64
        **implicitly(
65
            _elfdeps.to_pex_request(
66
                main=EntryPoint(PurePath(analyze_script_content.path).stem),
67
                sources=analyze_script_digest,
68
            )
69
        )
70
    )
71
    return ElfdepsAnalyzeWheelsTool(analyze_pex)
×
72

73

74
def rules() -> Iterable[Rule]:
×
75
    return collect_rules()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc