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

pantsbuild / pants / 24637157883

19 Apr 2026 07:23PM UTC coverage: 52.377% (-40.5%) from 92.924%
24637157883

Pull #23274

github

web-flow
Merge b54f275c2 into 0283af69e
Pull Request #23274: rust: upgrade to v1.95.0

31658 of 60443 relevant lines covered (52.38%)

1.05 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
# pants: infer-dep(elfdeps.lock*)
21

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

26

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

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

38
    default_main = ConsoleScript("elfdeps")
×
39
    default_requirements = ["elfdeps>=0.2.0"]
×
40

41
    default_interpreter_constraints = ["CPython>=3.10,<3.15"]
×
42
    register_interpreter_constraints = True
×
43

44
    default_lockfile_resource = (_ELFDEPS_PACKAGE, "elfdeps.lock")
×
45

46

47
@dataclass(frozen=True)
×
48
class ElfdepsAnalyzeWheelsTool:
×
49
    pex: VenvPex
×
50

51

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

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

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

75

76
def rules() -> Iterable[Rule]:
×
77
    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