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

pantsbuild / pants / 21042790249

15 Jan 2026 06:57PM UTC coverage: 43.263% (-35.4%) from 78.666%
21042790249

Pull #23021

github

web-flow
Merge cc03ad8de into d250c80fe
Pull Request #23021: WIP gh workflow scie pex

23 of 33 new or added lines in 3 files covered. (69.7%)

16147 existing lines in 521 files now uncovered.

26164 of 60477 relevant lines covered (43.26%)

0.87 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

UNCOV
4
from __future__ import annotations
×
5

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

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

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

24

UNCOV
25
class Elfdeps(PythonToolBase):
×
UNCOV
26
    options_scope = "elfdeps"
×
UNCOV
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

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

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

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

44

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

49

UNCOV
50
@rule(desc=f"Setup elfdeps/{_ANALYZE_SCRIPT}", level=LogLevel.DEBUG)
×
UNCOV
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

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