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

pantsbuild / pants / 26260209689

21 May 2026 11:59PM UTC coverage: 75.453% (-15.7%) from 91.156%
26260209689

Pull #23365

github

web-flow
Merge 5fe873b58 into 7ea655ba0
Pull Request #23365: uv.lock -> pex optimization

5 of 16 new or added lines in 1 file covered. (31.25%)

10118 existing lines in 378 files now uncovered.

54669 of 72454 relevant lines covered (75.45%)

2.31 hits per line

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

76.19
/src/python/pants/engine/platform.py
1
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
5✔
5

6
from enum import StrEnum
5✔
7

8
from pants.util.osutil import get_normalized_arch_name, get_normalized_os_name
5✔
9

10

11
class PlatformError(Exception):
5✔
12
    """Raise when an attempt is made to execute a process on a platform where it cannot succeed.
13

14
    E.g., because it requires a tool that is not supported on the platform.
15
    """
16

17

18
class Platform(StrEnum):
5✔
19
    linux_arm64 = "linux_arm64"
5✔
20
    linux_x86_64 = "linux_x86_64"
5✔
21
    macos_arm64 = "macos_arm64"
5✔
22
    macos_x86_64 = "macos_x86_64"
5✔
23

24
    @property
5✔
25
    def is_macos(self) -> bool:
5✔
26
        return self in [Platform.macos_arm64, Platform.macos_x86_64]
5✔
27

28
    @classmethod
5✔
29
    def create_for_localhost(cls) -> Platform:
5✔
30
        """Creates a Platform instance for localhost.
31

32
        This method should never be accessed directly by `@rules`: instead, to get the currently
33
        active `Platform`, they should request a `Platform` as a positional argument.
34
        """
35
        return Platform(f"{get_normalized_os_name()}_{get_normalized_arch_name()}")
5✔
36

37
    def for_linux(self) -> Platform:
5✔
38
        """Returns a Platform instance representing Linux on the Platform's architecture.
39

40
        Useful for fetching docker images runnable directly on the local architecture.
41
        """
UNCOV
42
        if self == Platform.macos_x86_64:
×
43
            return Platform.linux_x86_64
×
UNCOV
44
        elif self == Platform.macos_arm64:
×
45
            return Platform.linux_arm64
×
46
        else:
UNCOV
47
            return self
×
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