chore: use if TYPE_CHECKING: blocks (#2866)
This commit is contained in:
@@ -18,7 +18,7 @@ repos:
|
|||||||
exclude: ^cibuildwheel/resources/android/android.patch$
|
exclude: ^cibuildwheel/resources/android/android.patch$
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: 6fec9b7edb08fd9989088709d864a7826dc74e80 # frozen: v0.15.12
|
rev: 0c7b6c989466a93942def1f84baf36ddfcd60c83 # frozen: v0.15.14
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff-check
|
- id: ruff-check
|
||||||
args: ["--fix"]
|
args: ["--fix"]
|
||||||
|
|||||||
@@ -24,8 +24,9 @@ This will cache the results to all_known_setup.yaml; you can reprint
|
|||||||
the results without the `--online` setting.
|
the results without the `--online` setting.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
from collections.abc import Iterable, Iterator
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import click
|
import click
|
||||||
@@ -35,6 +36,10 @@ from rich import print
|
|||||||
|
|
||||||
from cibuildwheel.projectfiles import Analyzer
|
from cibuildwheel.projectfiles import Analyzer
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Iterable, Iterator
|
||||||
|
|
||||||
DIR = Path(__file__).parent.resolve()
|
DIR = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -17,13 +17,14 @@ Suggested usage:
|
|||||||
git diff
|
git diff
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import builtins
|
import builtins
|
||||||
import functools
|
import functools
|
||||||
import textwrap
|
import textwrap
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
from collections.abc import Iterable, Mapping, Sequence
|
|
||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -33,6 +34,10 @@ import click
|
|||||||
import yaml
|
import yaml
|
||||||
from github import Auth, Github, GithubException
|
from github import Auth, Github, GithubException
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Iterable, Mapping, Sequence
|
||||||
|
|
||||||
ICONS = (
|
ICONS = (
|
||||||
"github",
|
"github",
|
||||||
"azurepipelines",
|
"azurepipelines",
|
||||||
|
|||||||
@@ -12,14 +12,13 @@
|
|||||||
# [tool.uv.sources]
|
# [tool.uv.sources]
|
||||||
# cibuildwheel = { path = ".." }
|
# cibuildwheel = { path = ".." }
|
||||||
# ///
|
# ///
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import difflib
|
import difflib
|
||||||
import logging
|
import logging
|
||||||
import operator
|
import operator
|
||||||
import re
|
import re
|
||||||
import tomllib
|
import tomllib
|
||||||
from collections.abc import Mapping, MutableMapping
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Final, Literal, TypedDict
|
from typing import Any, Final, Literal, TypedDict
|
||||||
from xml.etree import ElementTree as ET
|
from xml.etree import ElementTree as ET
|
||||||
@@ -35,6 +34,10 @@ from rich.syntax import Syntax
|
|||||||
from cibuildwheel.extra import dump_python_configurations, get_pyodide_xbuildenv_info
|
from cibuildwheel.extra import dump_python_configurations, get_pyodide_xbuildenv_info
|
||||||
from cibuildwheel.platforms.android import android_triplet
|
from cibuildwheel.platforms.android import android_triplet
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Mapping, MutableMapping
|
||||||
|
|
||||||
log = logging.getLogger("cibw")
|
log = logging.getLogger("cibw")
|
||||||
|
|
||||||
# Looking up the dir instead of using utils.resources_dir
|
# Looking up the dir instead of using utils.resources_dir
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import contextlib
|
import contextlib
|
||||||
import dataclasses
|
import dataclasses
|
||||||
@@ -8,10 +10,8 @@ import sys
|
|||||||
import textwrap
|
import textwrap
|
||||||
import traceback
|
import traceback
|
||||||
import typing
|
import typing
|
||||||
from collections.abc import Generator, Iterable, Sequence
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
from typing import Any, Literal, TextIO
|
|
||||||
|
|
||||||
import cibuildwheel
|
import cibuildwheel
|
||||||
from cibuildwheel import errors
|
from cibuildwheel import errors
|
||||||
@@ -27,6 +27,11 @@ from cibuildwheel.util.file import CIBW_CACHE_PATH, ensure_cache_sentinel
|
|||||||
from cibuildwheel.util.helpers import strtobool
|
from cibuildwheel.util.helpers import strtobool
|
||||||
from cibuildwheel.util.resources import read_all_configs
|
from cibuildwheel.util.resources import read_all_configs
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Generator, Iterable, Sequence
|
||||||
|
from typing import Any, Literal, TextIO
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass
|
||||||
class GlobalOptions:
|
class GlobalOptions:
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import platform as platform_module
|
import platform as platform_module
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import typing
|
import typing
|
||||||
from collections.abc import Set
|
|
||||||
from enum import StrEnum, auto
|
from enum import StrEnum, auto
|
||||||
from typing import Final, Literal, Self
|
|
||||||
|
|
||||||
from cibuildwheel import errors
|
from cibuildwheel import errors
|
||||||
from cibuildwheel.typing import PlatformName
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Set
|
||||||
|
from typing import Final, Literal, Self
|
||||||
|
|
||||||
|
from cibuildwheel.typing import PlatformName
|
||||||
|
|
||||||
PRETTY_NAMES: Final[dict[PlatformName, str]] = {
|
PRETTY_NAMES: Final[dict[PlatformName, str]] = {
|
||||||
"linux": "Linux",
|
"linux": "Linux",
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from cibuildwheel import errors
|
from cibuildwheel import errors
|
||||||
from cibuildwheel.logger import log
|
from cibuildwheel.logger import log
|
||||||
from cibuildwheel.options import BuildOptions
|
|
||||||
from cibuildwheel.util.cmd import call, shell
|
from cibuildwheel.util.cmd import call, shell
|
||||||
from cibuildwheel.util.helpers import prepare_command
|
from cibuildwheel.util.helpers import prepare_command
|
||||||
from cibuildwheel.util.packaging import is_abi3_wheel
|
from cibuildwheel.util.packaging import is_abi3_wheel
|
||||||
from cibuildwheel.venv import activate_virtualenv, find_uv, virtualenv
|
from cibuildwheel.venv import activate_virtualenv, find_uv, virtualenv
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from cibuildwheel.options import BuildOptions
|
||||||
|
|
||||||
|
|
||||||
def run_audit(
|
def run_audit(
|
||||||
*,
|
*,
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import subprocess
|
import subprocess
|
||||||
from collections.abc import (
|
|
||||||
Callable,
|
|
||||||
Iterable,
|
|
||||||
Mapping,
|
|
||||||
Sequence,
|
|
||||||
)
|
|
||||||
|
|
||||||
import bashlex
|
import bashlex
|
||||||
|
|
||||||
# a function that takes a command and the environment, and returns the result
|
TYPE_CHECKING = False
|
||||||
EnvironmentExecutor = Callable[[list[str], dict[str, str]], str]
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import (
|
||||||
|
Callable,
|
||||||
|
Iterable,
|
||||||
|
Mapping,
|
||||||
|
Sequence,
|
||||||
|
)
|
||||||
|
|
||||||
|
# a function that takes a command and the environment, and returns the result
|
||||||
|
EnvironmentExecutor = Callable[[list[str], dict[str, str]], str]
|
||||||
|
|
||||||
|
|
||||||
def local_environment_executor(command: Sequence[str], env: Mapping[str, str]) -> str:
|
def local_environment_executor(command: Sequence[str], env: Mapping[str, str]) -> str:
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from collections.abc import Mapping, Sequence
|
from typing import Protocol
|
||||||
from typing import Any, Protocol
|
|
||||||
|
|
||||||
import bashlex
|
import bashlex
|
||||||
import bashlex.errors
|
import bashlex.errors
|
||||||
|
|
||||||
from cibuildwheel import bashlex_eval
|
from cibuildwheel import bashlex_eval
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Mapping, Sequence
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
class EnvironmentParseError(Exception):
|
class EnvironmentParseError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -2,17 +2,24 @@
|
|||||||
These are utilities for the `/bin` scripts, not for the `cibuildwheel` program.
|
These are utilities for the `/bin` scripts, not for the `cibuildwheel` program.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import typing
|
import typing
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from collections.abc import Mapping, Sequence
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from typing import Any, NotRequired, Protocol
|
from typing import NotRequired, Protocol
|
||||||
|
|
||||||
from cibuildwheel import __version__ as cibw_version
|
from cibuildwheel import __version__ as cibw_version
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Mapping, Sequence
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
__all__ = ("Printable", "dump_python_configurations")
|
__all__ = ("Printable", "dump_python_configurations")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import shlex
|
import shlex
|
||||||
import typing
|
import typing
|
||||||
from collections.abc import Sequence
|
from typing import Literal, get_args
|
||||||
from typing import Literal, Self, get_args
|
|
||||||
|
|
||||||
from cibuildwheel.typing import PathOrStr
|
|
||||||
from cibuildwheel.util.helpers import parse_key_value_string, prepare_command
|
from cibuildwheel.util.helpers import parse_key_value_string, prepare_command
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Sequence
|
||||||
|
from typing import Self
|
||||||
|
|
||||||
|
from cibuildwheel.typing import PathOrStr
|
||||||
|
|
||||||
BuildFrontendName = Literal["pip", "build", "build[uv]", "uv"]
|
BuildFrontendName = Literal["pip", "build", "build[uv]", "uv"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import contextlib
|
import contextlib
|
||||||
import dataclasses
|
import dataclasses
|
||||||
@@ -9,9 +11,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
from collections.abc import Generator
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import IO, AnyStr, Final, Literal
|
|
||||||
|
|
||||||
import humanize
|
import humanize
|
||||||
|
|
||||||
@@ -19,9 +19,13 @@ from cibuildwheel.ci import CIProvider, detect_ci_provider, filter_ansi_codes
|
|||||||
|
|
||||||
TYPE_CHECKING = False
|
TYPE_CHECKING = False
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Generator
|
||||||
|
from typing import IO, AnyStr, Final, Literal
|
||||||
|
|
||||||
from cibuildwheel.options import Options
|
from cibuildwheel.options import Options
|
||||||
|
|
||||||
FoldPattern = tuple[str, str]
|
FoldPattern = tuple[str, str]
|
||||||
|
|
||||||
DEFAULT_FOLD_PATTERN: Final[FoldPattern] = ("{name}", "")
|
DEFAULT_FOLD_PATTERN: Final[FoldPattern] = ("{name}", "")
|
||||||
FOLD_PATTERNS: Final[dict[str, FoldPattern]] = {
|
FOLD_PATTERNS: Final[dict[str, FoldPattern]] = {
|
||||||
"azure": ("##[group]{name}", "##[endgroup]"),
|
"azure": ("##[group]{name}", "##[endgroup]"),
|
||||||
@@ -235,7 +239,7 @@ class Logger:
|
|||||||
print(f"cibuildwheel: {c.bright_red}error{c.end}: {error}\n", file=sys.stderr)
|
print(f"cibuildwheel: {c.bright_red}error{c.end}: {error}\n", file=sys.stderr)
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def print_summary(self, *, options: "Options") -> Generator[None, None, None]:
|
def print_summary(self, *, options: Options) -> Generator[None, None, None]:
|
||||||
start = time.time()
|
start = time.time()
|
||||||
yield
|
yield
|
||||||
duration = time.time() - start
|
duration = time.time() - start
|
||||||
@@ -293,7 +297,7 @@ class Logger:
|
|||||||
# lowercase, shorten
|
# lowercase, shorten
|
||||||
return identifier.lower()[:20]
|
return identifier.lower()[:20]
|
||||||
|
|
||||||
def _github_step_summary(self, duration: float, options: "Options") -> str:
|
def _github_step_summary(self, duration: float, options: Options) -> str:
|
||||||
"""
|
"""
|
||||||
Returns the GitHub step summary, in markdown format.
|
Returns the GitHub step summary, in markdown format.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
@@ -10,19 +12,25 @@ import sys
|
|||||||
import textwrap
|
import textwrap
|
||||||
import typing
|
import typing
|
||||||
import uuid
|
import uuid
|
||||||
from collections.abc import Mapping, Sequence
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path, PurePath, PurePosixPath
|
from pathlib import PurePosixPath
|
||||||
from types import TracebackType
|
from typing import Literal, assert_never
|
||||||
from typing import IO, Literal, Self, assert_never
|
|
||||||
|
|
||||||
from cibuildwheel.ci import CIProvider, detect_ci_provider
|
from cibuildwheel.ci import CIProvider, detect_ci_provider
|
||||||
from cibuildwheel.errors import OCIEngineTooOldError
|
from cibuildwheel.errors import OCIEngineTooOldError
|
||||||
from cibuildwheel.logger import log
|
from cibuildwheel.logger import log
|
||||||
from cibuildwheel.typing import PathOrStr
|
|
||||||
from cibuildwheel.util.cmd import call
|
from cibuildwheel.util.cmd import call
|
||||||
from cibuildwheel.util.helpers import FlexibleVersion, parse_key_value_string, strtobool
|
from cibuildwheel.util.helpers import FlexibleVersion, parse_key_value_string, strtobool
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Mapping, Sequence
|
||||||
|
from pathlib import Path, PurePath
|
||||||
|
from types import TracebackType
|
||||||
|
from typing import IO, Self
|
||||||
|
|
||||||
|
from cibuildwheel.typing import PathOrStr
|
||||||
|
|
||||||
ContainerEngineName = Literal["docker", "podman"]
|
ContainerEngineName = Literal["docker", "podman"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import configparser
|
import configparser
|
||||||
import contextlib
|
import contextlib
|
||||||
@@ -8,9 +10,9 @@ import functools
|
|||||||
import shlex
|
import shlex
|
||||||
import textwrap
|
import textwrap
|
||||||
import tomllib
|
import tomllib
|
||||||
from collections.abc import Callable, Generator, Iterable, Mapping, Sequence, Set
|
from collections.abc import Mapping, Sequence
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Final, Literal, Self, assert_never
|
from typing import assert_never
|
||||||
|
|
||||||
from packaging.specifiers import SpecifierSet
|
from packaging.specifiers import SpecifierSet
|
||||||
|
|
||||||
@@ -27,6 +29,11 @@ from cibuildwheel.util import resources
|
|||||||
from cibuildwheel.util.helpers import format_safe, parse_key_value_string, strtobool, unwrap
|
from cibuildwheel.util.helpers import format_safe, parse_key_value_string, strtobool, unwrap
|
||||||
from cibuildwheel.util.packaging import DependencyConstraints
|
from cibuildwheel.util.packaging import DependencyConstraints
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Callable, Generator, Iterable, Set
|
||||||
|
from typing import Any, Final, Literal, Self
|
||||||
|
|
||||||
MANYLINUX_ARCHS: Final[tuple[str, ...]] = (
|
MANYLINUX_ARCHS: Final[tuple[str, ...]] = (
|
||||||
"x86_64",
|
"x86_64",
|
||||||
"i686",
|
"i686",
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from collections.abc import Sequence
|
from typing import Protocol
|
||||||
from pathlib import Path
|
|
||||||
from typing import Final, Protocol
|
|
||||||
|
|
||||||
from cibuildwheel import errors
|
from cibuildwheel import errors
|
||||||
from cibuildwheel.architecture import Architecture
|
|
||||||
from cibuildwheel.options import Options
|
|
||||||
from cibuildwheel.platforms import android, ios, linux, macos, pyodide, windows
|
from cibuildwheel.platforms import android, ios, linux, macos, pyodide, windows
|
||||||
from cibuildwheel.selector import BuildSelector
|
|
||||||
from cibuildwheel.typing import GenericPythonConfiguration, PlatformName
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Sequence
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Final
|
||||||
|
|
||||||
|
from cibuildwheel.architecture import Architecture
|
||||||
|
from cibuildwheel.options import Options
|
||||||
|
from cibuildwheel.selector import BuildSelector
|
||||||
|
from cibuildwheel.typing import GenericPythonConfiguration, PlatformName
|
||||||
|
|
||||||
|
|
||||||
class PlatformModule(Protocol):
|
class PlatformModule(Protocol):
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
@@ -7,7 +9,6 @@ import shlex
|
|||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sysconfig
|
import sysconfig
|
||||||
from collections.abc import Iterable, Iterator, MutableMapping
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from os.path import relpath
|
from os.path import relpath
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -31,8 +32,6 @@ from cibuildwheel.frontend import (
|
|||||||
prepare_config_settings,
|
prepare_config_settings,
|
||||||
)
|
)
|
||||||
from cibuildwheel.logger import log
|
from cibuildwheel.logger import log
|
||||||
from cibuildwheel.options import BuildOptions, Options
|
|
||||||
from cibuildwheel.selector import BuildSelector
|
|
||||||
from cibuildwheel.util import resources
|
from cibuildwheel.util import resources
|
||||||
from cibuildwheel.util.cmd import call, shell
|
from cibuildwheel.util.cmd import call, shell
|
||||||
from cibuildwheel.util.file import CIBW_CACHE_PATH, copy_test_sources, download, move_file
|
from cibuildwheel.util.file import CIBW_CACHE_PATH, copy_test_sources, download, move_file
|
||||||
@@ -41,8 +40,14 @@ from cibuildwheel.util.packaging import find_compatible_wheel
|
|||||||
from cibuildwheel.util.python_build_standalone import create_python_build_standalone_environment
|
from cibuildwheel.util.python_build_standalone import create_python_build_standalone_environment
|
||||||
from cibuildwheel.venv import constraint_flags, find_uv, virtualenv
|
from cibuildwheel.venv import constraint_flags, find_uv, virtualenv
|
||||||
|
|
||||||
RESOURCES_ANDROID = resources.PATH / "android"
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Iterable, Iterator, MutableMapping
|
||||||
|
|
||||||
|
from cibuildwheel.options import BuildOptions, Options
|
||||||
|
from cibuildwheel.selector import BuildSelector
|
||||||
|
|
||||||
|
RESOURCES_ANDROID = resources.PATH / "android"
|
||||||
ANDROID_TRIPLET = {
|
ANDROID_TRIPLET = {
|
||||||
"arm64_v8a": "aarch64-linux-android",
|
"arm64_v8a": "aarch64-linux-android",
|
||||||
"x86_64": "x86_64-linux-android",
|
"x86_64": "x86_64-linux-android",
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
@@ -6,7 +8,6 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from collections.abc import Sequence, Set
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import assert_never
|
from typing import assert_never
|
||||||
|
|
||||||
@@ -14,18 +15,14 @@ from filelock import FileLock
|
|||||||
from packaging.version import Version
|
from packaging.version import Version
|
||||||
|
|
||||||
from cibuildwheel import errors
|
from cibuildwheel import errors
|
||||||
from cibuildwheel.architecture import Architecture
|
|
||||||
from cibuildwheel.audit import run_audit
|
from cibuildwheel.audit import run_audit
|
||||||
from cibuildwheel.environment import ParsedEnvironment
|
|
||||||
from cibuildwheel.frontend import (
|
from cibuildwheel.frontend import (
|
||||||
BuildFrontendName,
|
BuildFrontendName,
|
||||||
get_build_frontend_extra_flags,
|
get_build_frontend_extra_flags,
|
||||||
prepare_config_settings,
|
prepare_config_settings,
|
||||||
)
|
)
|
||||||
from cibuildwheel.logger import log
|
from cibuildwheel.logger import log
|
||||||
from cibuildwheel.options import Options
|
|
||||||
from cibuildwheel.platforms.macos import install_cpython as install_build_cpython
|
from cibuildwheel.platforms.macos import install_cpython as install_build_cpython
|
||||||
from cibuildwheel.selector import BuildSelector
|
|
||||||
from cibuildwheel.util import resources
|
from cibuildwheel.util import resources
|
||||||
from cibuildwheel.util.cmd import call, shell, split_command
|
from cibuildwheel.util.cmd import call, shell, split_command
|
||||||
from cibuildwheel.util.file import CIBW_CACHE_PATH, copy_test_sources, download, move_file
|
from cibuildwheel.util.file import CIBW_CACHE_PATH, copy_test_sources, download, move_file
|
||||||
@@ -33,6 +30,15 @@ from cibuildwheel.util.helpers import prepare_command, unwrap_preserving_paragra
|
|||||||
from cibuildwheel.util.packaging import find_compatible_wheel
|
from cibuildwheel.util.packaging import find_compatible_wheel
|
||||||
from cibuildwheel.venv import constraint_flags, virtualenv
|
from cibuildwheel.venv import constraint_flags, virtualenv
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Sequence, Set
|
||||||
|
|
||||||
|
from cibuildwheel.architecture import Architecture
|
||||||
|
from cibuildwheel.environment import ParsedEnvironment
|
||||||
|
from cibuildwheel.options import Options
|
||||||
|
from cibuildwheel.selector import BuildSelector
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True, kw_only=True)
|
@dataclasses.dataclass(frozen=True, kw_only=True)
|
||||||
class PythonConfiguration:
|
class PythonConfiguration:
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import shutil
|
import shutil
|
||||||
@@ -5,7 +7,6 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from collections.abc import Iterable, Iterator, Sequence, Set
|
|
||||||
from pathlib import Path, PurePath, PurePosixPath
|
from pathlib import Path, PurePath, PurePosixPath
|
||||||
from typing import assert_never
|
from typing import assert_never
|
||||||
|
|
||||||
@@ -15,8 +16,6 @@ from cibuildwheel.audit import needs_audit, run_audit
|
|||||||
from cibuildwheel.frontend import get_build_frontend_extra_flags, prepare_config_settings
|
from cibuildwheel.frontend import get_build_frontend_extra_flags, prepare_config_settings
|
||||||
from cibuildwheel.logger import log
|
from cibuildwheel.logger import log
|
||||||
from cibuildwheel.oci_container import OCIContainer, OCIContainerEngineConfig, OCIPlatform
|
from cibuildwheel.oci_container import OCIContainer, OCIContainerEngineConfig, OCIPlatform
|
||||||
from cibuildwheel.options import BuildOptions, Options
|
|
||||||
from cibuildwheel.selector import BuildSelector
|
|
||||||
from cibuildwheel.util import resources
|
from cibuildwheel.util import resources
|
||||||
from cibuildwheel.util.file import copy_test_sources
|
from cibuildwheel.util.file import copy_test_sources
|
||||||
from cibuildwheel.util.helpers import prepare_command, unwrap
|
from cibuildwheel.util.helpers import prepare_command, unwrap
|
||||||
@@ -24,6 +23,10 @@ from cibuildwheel.util.packaging import find_compatible_wheel
|
|||||||
|
|
||||||
TYPE_CHECKING = False
|
TYPE_CHECKING = False
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Iterable, Iterator, Sequence, Set
|
||||||
|
|
||||||
|
from cibuildwheel.options import BuildOptions, Options
|
||||||
|
from cibuildwheel.selector import BuildSelector
|
||||||
from cibuildwheel.typing import PathOrStr
|
from cibuildwheel.typing import PathOrStr
|
||||||
|
|
||||||
ARCHITECTURE_OCI_PLATFORM_MAP = {
|
ARCHITECTURE_OCI_PLATFORM_MAP = {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
@@ -8,26 +10,21 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import typing
|
import typing
|
||||||
from collections.abc import Set
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Literal, assert_never
|
from typing import assert_never
|
||||||
|
|
||||||
from filelock import FileLock
|
from filelock import FileLock
|
||||||
from packaging.version import Version
|
from packaging.version import Version
|
||||||
|
|
||||||
from cibuildwheel import errors
|
from cibuildwheel import errors
|
||||||
from cibuildwheel.architecture import Architecture
|
|
||||||
from cibuildwheel.audit import run_audit
|
from cibuildwheel.audit import run_audit
|
||||||
from cibuildwheel.ci import detect_ci_provider
|
from cibuildwheel.ci import detect_ci_provider
|
||||||
from cibuildwheel.environment import ParsedEnvironment
|
|
||||||
from cibuildwheel.frontend import (
|
from cibuildwheel.frontend import (
|
||||||
BuildFrontendName,
|
BuildFrontendName,
|
||||||
get_build_frontend_extra_flags,
|
get_build_frontend_extra_flags,
|
||||||
prepare_config_settings,
|
prepare_config_settings,
|
||||||
)
|
)
|
||||||
from cibuildwheel.logger import log
|
from cibuildwheel.logger import log
|
||||||
from cibuildwheel.options import Options
|
|
||||||
from cibuildwheel.selector import BuildSelector
|
|
||||||
from cibuildwheel.util import resources
|
from cibuildwheel.util import resources
|
||||||
from cibuildwheel.util.cmd import call, shell
|
from cibuildwheel.util.cmd import call, shell
|
||||||
from cibuildwheel.util.file import CIBW_CACHE_PATH, copy_test_sources, download, move_file
|
from cibuildwheel.util.file import CIBW_CACHE_PATH, copy_test_sources, download, move_file
|
||||||
@@ -35,6 +32,16 @@ from cibuildwheel.util.helpers import prepare_command, unwrap
|
|||||||
from cibuildwheel.util.packaging import find_compatible_wheel, get_pip_version
|
from cibuildwheel.util.packaging import find_compatible_wheel, get_pip_version
|
||||||
from cibuildwheel.venv import constraint_flags, find_uv, target_marker_env, virtualenv
|
from cibuildwheel.venv import constraint_flags, find_uv, target_marker_env, virtualenv
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Set
|
||||||
|
from typing import Literal
|
||||||
|
|
||||||
|
from cibuildwheel.architecture import Architecture
|
||||||
|
from cibuildwheel.environment import ParsedEnvironment
|
||||||
|
from cibuildwheel.options import Options
|
||||||
|
from cibuildwheel.selector import BuildSelector
|
||||||
|
|
||||||
|
|
||||||
@functools.cache
|
@functools.cache
|
||||||
def get_macos_version() -> tuple[int, int]:
|
def get_macos_version() -> tuple[int, int]:
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import functools
|
import functools
|
||||||
import json
|
import json
|
||||||
@@ -7,7 +9,6 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import tomllib
|
import tomllib
|
||||||
import typing
|
import typing
|
||||||
from collections.abc import Set
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
from typing import Final, TypedDict
|
from typing import Final, TypedDict
|
||||||
@@ -17,11 +18,8 @@ from filelock import FileLock
|
|||||||
from cibuildwheel import errors
|
from cibuildwheel import errors
|
||||||
from cibuildwheel.architecture import Architecture
|
from cibuildwheel.architecture import Architecture
|
||||||
from cibuildwheel.audit import run_audit
|
from cibuildwheel.audit import run_audit
|
||||||
from cibuildwheel.environment import ParsedEnvironment
|
|
||||||
from cibuildwheel.frontend import get_build_frontend_extra_flags, prepare_config_settings
|
from cibuildwheel.frontend import get_build_frontend_extra_flags, prepare_config_settings
|
||||||
from cibuildwheel.logger import log
|
from cibuildwheel.logger import log
|
||||||
from cibuildwheel.options import Options
|
|
||||||
from cibuildwheel.selector import BuildSelector
|
|
||||||
from cibuildwheel.util import resources
|
from cibuildwheel.util import resources
|
||||||
from cibuildwheel.util.cmd import call, shell
|
from cibuildwheel.util.cmd import call, shell
|
||||||
from cibuildwheel.util.file import (
|
from cibuildwheel.util.file import (
|
||||||
@@ -40,6 +38,14 @@ from cibuildwheel.util.python_build_standalone import (
|
|||||||
)
|
)
|
||||||
from cibuildwheel.venv import constraint_flags, virtualenv
|
from cibuildwheel.venv import constraint_flags, virtualenv
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Set
|
||||||
|
|
||||||
|
from cibuildwheel.environment import ParsedEnvironment
|
||||||
|
from cibuildwheel.options import Options
|
||||||
|
from cibuildwheel.selector import BuildSelector
|
||||||
|
|
||||||
IS_WIN: Final[bool] = sys.platform.startswith("win")
|
IS_WIN: Final[bool] = sys.platform.startswith("win")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@@ -5,7 +7,6 @@ import platform as platform_module
|
|||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
from collections.abc import MutableMapping, Sequence, Set
|
|
||||||
from functools import cache
|
from functools import cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import assert_never
|
from typing import assert_never
|
||||||
@@ -15,15 +16,12 @@ from filelock import FileLock
|
|||||||
from cibuildwheel import errors
|
from cibuildwheel import errors
|
||||||
from cibuildwheel.architecture import Architecture
|
from cibuildwheel.architecture import Architecture
|
||||||
from cibuildwheel.audit import run_audit
|
from cibuildwheel.audit import run_audit
|
||||||
from cibuildwheel.environment import ParsedEnvironment
|
|
||||||
from cibuildwheel.frontend import (
|
from cibuildwheel.frontend import (
|
||||||
BuildFrontendName,
|
BuildFrontendName,
|
||||||
get_build_frontend_extra_flags,
|
get_build_frontend_extra_flags,
|
||||||
prepare_config_settings,
|
prepare_config_settings,
|
||||||
)
|
)
|
||||||
from cibuildwheel.logger import log
|
from cibuildwheel.logger import log
|
||||||
from cibuildwheel.options import Options
|
|
||||||
from cibuildwheel.selector import BuildSelector
|
|
||||||
from cibuildwheel.util import resources
|
from cibuildwheel.util import resources
|
||||||
from cibuildwheel.util.cmd import call, shell
|
from cibuildwheel.util.cmd import call, shell
|
||||||
from cibuildwheel.util.file import (
|
from cibuildwheel.util.file import (
|
||||||
@@ -37,6 +35,14 @@ from cibuildwheel.util.helpers import prepare_command, unwrap
|
|||||||
from cibuildwheel.util.packaging import find_compatible_wheel, get_pip_version
|
from cibuildwheel.util.packaging import find_compatible_wheel, get_pip_version
|
||||||
from cibuildwheel.venv import constraint_flags, find_uv, target_marker_env, virtualenv
|
from cibuildwheel.venv import constraint_flags, find_uv, target_marker_env, virtualenv
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import MutableMapping, Sequence, Set
|
||||||
|
|
||||||
|
from cibuildwheel.environment import ParsedEnvironment
|
||||||
|
from cibuildwheel.options import Options
|
||||||
|
from cibuildwheel.selector import BuildSelector
|
||||||
|
|
||||||
|
|
||||||
def get_nuget_args(
|
def get_nuget_args(
|
||||||
version: str, arch: str, free_threaded: bool, output_directory: Path
|
version: str, arch: str, free_threaded: bool, output_directory: Path
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
import configparser
|
import configparser
|
||||||
import contextlib
|
import contextlib
|
||||||
from pathlib import Path
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
import dependency_groups
|
import dependency_groups
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
def get_parent(node: ast.AST | None, depth: int = 1) -> ast.AST | None:
|
def get_parent(node: ast.AST | None, depth: int = 1) -> ast.AST | None:
|
||||||
for _ in range(depth):
|
for _ in range(depth):
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from cibuildwheel.util import resources
|
from cibuildwheel.util import resources
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
def get_schema(tool_name: str = "cibuildwheel") -> dict[str, Any]:
|
def get_schema(tool_name: str = "cibuildwheel") -> dict[str, Any]:
|
||||||
"Get the stored complete schema for cibuildwheel settings."
|
"Get the stored complete schema for cibuildwheel settings."
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import itertools
|
import itertools
|
||||||
from enum import StrEnum
|
from enum import StrEnum
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
from typing import Self
|
|
||||||
|
|
||||||
import bracex
|
import bracex
|
||||||
from packaging.specifiers import SpecifierSet
|
|
||||||
from packaging.version import Version
|
from packaging.version import Version
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from typing import Self
|
||||||
|
|
||||||
|
from packaging.specifiers import SpecifierSet
|
||||||
|
|
||||||
|
|
||||||
def selector_matches(patterns: str, string: str) -> bool:
|
def selector_matches(patterns: str, string: str) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shlex
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import typing
|
import typing
|
||||||
from collections.abc import Iterator, Mapping
|
|
||||||
from typing import Final, Literal
|
|
||||||
|
|
||||||
from cibuildwheel.errors import FatalError
|
from cibuildwheel.errors import FatalError
|
||||||
from cibuildwheel.typing import PathOrStr
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Iterator, Mapping
|
||||||
|
from typing import Final, Literal
|
||||||
|
|
||||||
|
from cibuildwheel.typing import PathOrStr
|
||||||
|
|
||||||
_IS_WIN: Final[bool] = sys.platform.startswith("win")
|
_IS_WIN: Final[bool] = sys.platform.startswith("win")
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import ssl
|
import ssl
|
||||||
import tarfile
|
import tarfile
|
||||||
import time
|
import time
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from collections.abc import Callable
|
|
||||||
from pathlib import Path, PurePath
|
from pathlib import Path, PurePath
|
||||||
from typing import Final
|
from typing import Final
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
@@ -14,6 +15,10 @@ from platformdirs import user_cache_path
|
|||||||
|
|
||||||
from cibuildwheel.errors import FatalError
|
from cibuildwheel.errors import FatalError
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Callable
|
||||||
|
|
||||||
DEFAULT_CIBW_CACHE_PATH: Final[Path] = user_cache_path(appname="cibuildwheel", appauthor="pypa")
|
DEFAULT_CIBW_CACHE_PATH: Final[Path] = user_cache_path(appname="cibuildwheel", appauthor="pypa")
|
||||||
CIBW_CACHE_PATH: Final[Path] = Path(
|
CIBW_CACHE_PATH: Final[Path] = Path(
|
||||||
os.environ.get("CIBW_CACHE_PATH", DEFAULT_CIBW_CACHE_PATH)
|
os.environ.get("CIBW_CACHE_PATH", DEFAULT_CIBW_CACHE_PATH)
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import textwrap
|
import textwrap
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Sequence
|
|
||||||
|
|
||||||
from cibuildwheel.typing import PathOrStr
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
import os
|
||||||
|
from collections.abc import Sequence
|
||||||
|
|
||||||
|
from cibuildwheel.typing import PathOrStr
|
||||||
|
|
||||||
|
|
||||||
def format_safe(template: str, **kwargs: str | os.PathLike[str]) -> str:
|
def format_safe(template: str, **kwargs: str | os.PathLike[str]) -> str:
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import shlex
|
import shlex
|
||||||
from collections.abc import Mapping, Sequence
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from pathlib import Path, PurePath
|
from pathlib import Path, PurePath
|
||||||
from typing import Literal, Self, TypeVar
|
from typing import TypeVar
|
||||||
|
|
||||||
from packaging.utils import parse_wheel_filename
|
from packaging.utils import parse_wheel_filename
|
||||||
|
|
||||||
@@ -10,6 +11,11 @@ from cibuildwheel.util import resources
|
|||||||
from cibuildwheel.util.cmd import call
|
from cibuildwheel.util.cmd import call
|
||||||
from cibuildwheel.util.helpers import parse_key_value_string, unwrap
|
from cibuildwheel.util.helpers import parse_key_value_string, unwrap
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Mapping, Sequence
|
||||||
|
from typing import Literal, Self
|
||||||
|
|
||||||
|
|
||||||
@dataclass(kw_only=True)
|
@dataclass(kw_only=True)
|
||||||
class DependencyConstraints:
|
class DependencyConstraints:
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import functools
|
import functools
|
||||||
import json
|
import json
|
||||||
import platform
|
import platform
|
||||||
import typing
|
import typing
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from filelock import FileLock
|
from filelock import FileLock
|
||||||
|
|
||||||
from cibuildwheel.util.file import download, extract_tar
|
from cibuildwheel.util.file import download, extract_tar
|
||||||
from cibuildwheel.util.resources import PYTHON_BUILD_STANDALONE_RELEASES
|
from cibuildwheel.util.resources import PYTHON_BUILD_STANDALONE_RELEASES
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
class PythonBuildStandaloneAsset(typing.TypedDict):
|
class PythonBuildStandaloneAsset(typing.TypedDict):
|
||||||
name: str
|
name: str
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import tomllib
|
import tomllib
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Final
|
|
||||||
|
|
||||||
from cibuildwheel.typing import PlatformName
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from typing import Final
|
||||||
|
|
||||||
|
from cibuildwheel.typing import PlatformName
|
||||||
|
|
||||||
PATH: Final[Path] = Path(__file__).parent.parent / "resources"
|
PATH: Final[Path] = Path(__file__).parent.parent / "resources"
|
||||||
INSTALL_CERTIFI_SCRIPT: Final[Path] = PATH / "install_certifi.py"
|
INSTALL_CERTIFI_SCRIPT: Final[Path] = PATH / "install_certifi.py"
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import functools
|
import functools
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import tomllib
|
import tomllib
|
||||||
from collections.abc import Sequence
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Final, cast
|
from typing import cast
|
||||||
|
|
||||||
from filelock import FileLock
|
from filelock import FileLock
|
||||||
from packaging.markers import default_environment
|
from packaging.markers import default_environment
|
||||||
@@ -17,6 +18,11 @@ from cibuildwheel.util import resources
|
|||||||
from cibuildwheel.util.cmd import call
|
from cibuildwheel.util.cmd import call
|
||||||
from cibuildwheel.util.file import CIBW_CACHE_PATH, download
|
from cibuildwheel.util.file import CIBW_CACHE_PATH, download
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Sequence
|
||||||
|
from typing import Final
|
||||||
|
|
||||||
_IS_WIN: Final[bool] = sys.platform.startswith("win")
|
_IS_WIN: Final[bool] = sys.platform.startswith("win")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -224,6 +224,7 @@ flake8-unused-arguments.ignore-variadic-names = true
|
|||||||
flake8-tidy-imports.ban-relative-imports = "all"
|
flake8-tidy-imports.ban-relative-imports = "all"
|
||||||
flake8-annotations.allow-star-arg-any = true
|
flake8-annotations.allow-star-arg-any = true
|
||||||
flake8-annotations.mypy-init-return = true
|
flake8-annotations.mypy-init-return = true
|
||||||
|
future-annotations = true
|
||||||
|
|
||||||
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
||||||
"typing.Mapping".msg = "Use collections.abc.Mapping instead."
|
"typing.Mapping".msg = "Use collections.abc.Mapping instead."
|
||||||
|
|||||||
+6
-1
@@ -1,7 +1,8 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
from collections.abc import Generator
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from filelock import FileLock
|
from filelock import FileLock
|
||||||
@@ -16,6 +17,10 @@ from cibuildwheel.venv import find_uv
|
|||||||
from . import utils
|
from . import utils
|
||||||
from .utils import DEFAULT_CIBW_ENABLE, EMULATED_ARCHS, get_platform
|
from .utils import DEFAULT_CIBW_ENABLE, EMULATED_ARCHS, get_platform
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Generator
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser: pytest.Parser) -> None:
|
def pytest_addoption(parser: pytest.Parser) -> None:
|
||||||
parser.addoption(
|
parser.addoption(
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import packaging.utils
|
import packaging.utils
|
||||||
import pytest
|
import pytest
|
||||||
@@ -9,6 +10,10 @@ from cibuildwheel.selector import EnableGroup
|
|||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
basic_project = test_projects.new_c_project(
|
basic_project = test_projects.new_c_project(
|
||||||
setup_py_add=textwrap.dedent(
|
setup_py_add=textwrap.dedent(
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
pyproject_toml = r"""
|
pyproject_toml = r"""
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools", "wheel"]
|
requires = ["setuptools", "wheel"]
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
import textwrap
|
from __future__ import annotations
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import textwrap
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
pyproject_toml = r"""
|
pyproject_toml = r"""
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools", "wheel"]
|
requires = ["setuptools", "wheel"]
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
project_with_before_build_asserts = test_projects.new_c_project(
|
project_with_before_build_asserts = test_projects.new_c_project(
|
||||||
setup_py_add=textwrap.dedent(
|
setup_py_add=textwrap.dedent(
|
||||||
r"""
|
r"""
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# pyodide does not support building without isolation, need to check the base_prefix
|
# pyodide does not support building without isolation, need to check the base_prefix
|
||||||
SYS_PREFIX = f"sys.{'base_' if utils.get_platform() == 'pyodide' else ''}prefix"
|
SYS_PREFIX = f"sys.{'base_' if utils.get_platform() == 'pyodide' else ''}prefix"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
from pathlib import Path
|
from __future__ import annotations
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
before_test_project = test_projects.new_c_project()
|
before_test_project = test_projects.new_c_project()
|
||||||
before_test_project.files["test/spam_test.py"] = r"""
|
before_test_project.files["test/spam_test.py"] = r"""
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"frontend_name",
|
"frontend_name",
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
project_with_skip_asserts = test_projects.new_c_project(
|
project_with_skip_asserts = test_projects.new_c_project(
|
||||||
setup_py_add=textwrap.dedent(
|
setup_py_add=textwrap.dedent(
|
||||||
rf"""
|
rf"""
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
from pathlib import Path
|
from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
basic_project = test_projects.new_c_project()
|
basic_project = test_projects.new_c_project()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
dockcross_only_project = test_projects.new_c_project(
|
dockcross_only_project = test_projects.new_c_project(
|
||||||
setup_py_add=textwrap.dedent(
|
setup_py_add=textwrap.dedent(
|
||||||
r"""
|
r"""
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
from pathlib import Path
|
from __future__ import annotations
|
||||||
|
|
||||||
import jinja2
|
import jinja2
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
from .test_projects import TestProject
|
from .test_projects import TestProject
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
cpp_test_project = TestProject()
|
cpp_test_project = TestProject()
|
||||||
|
|
||||||
setup_py_template = r"""
|
setup_py_template = r"""
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
from contextlib import nullcontext as does_not_raise
|
from contextlib import nullcontext as does_not_raise
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -9,6 +10,10 @@ from test import test_projects
|
|||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
basic_project = test_projects.new_c_project()
|
basic_project = test_projects.new_c_project()
|
||||||
basic_project.files["repair.py"] = """
|
basic_project.files["repair.py"] = """
|
||||||
import shutil
|
import shutil
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -10,6 +11,10 @@ from cibuildwheel.util import resources
|
|||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
VERSION_REGEX = r"([\w-]+)==([^;\s]+)"
|
VERSION_REGEX = r"([\w-]+)==([^;\s]+)"
|
||||||
|
|
||||||
CHECK_VERSIONS_SCRIPT = """\
|
CHECK_VERSIONS_SCRIPT = """\
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
project_with_a_test = test_projects.new_c_project()
|
project_with_a_test = test_projects.new_c_project()
|
||||||
|
|
||||||
project_with_a_test.files["test/spam_test.py"] = r"""
|
project_with_a_test.files["test/spam_test.py"] = r"""
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
project_with_environment_asserts = test_projects.new_c_project(
|
project_with_environment_asserts = test_projects.new_c_project(
|
||||||
setup_py_add=textwrap.dedent(
|
setup_py_add=textwrap.dedent(
|
||||||
r"""
|
r"""
|
||||||
|
|||||||
+10
-5
@@ -1,17 +1,22 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from collections.abc import Mapping
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from test.test_projects.base import TestProject
|
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Mapping
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from test.test_projects.base import TestProject
|
||||||
|
|
||||||
# utilities
|
# utilities
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -1,14 +1,19 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
pytestmark = pytest.mark.ios
|
pytestmark = pytest.mark.ios
|
||||||
|
|
||||||
CIBW_PLATFORM = os.environ.get("CIBW_PLATFORM", "ios")
|
CIBW_PLATFORM = os.environ.get("CIBW_PLATFORM", "ios")
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def test_python_exist(tmp_path: Path, capfd: pytest.CaptureFixture[str]) -> None:
|
def test_python_exist(tmp_path: Path, capfd: pytest.CaptureFixture[str]) -> None:
|
||||||
if utils.get_platform() != "linux":
|
if utils.get_platform() != "linux":
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
basic_project = test_projects.new_c_project()
|
basic_project = test_projects.new_c_project()
|
||||||
basic_project.files["tests/test_suite.py"] = r"""
|
basic_project.files["tests/test_suite.py"] = r"""
|
||||||
import platform
|
import platform
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# TODO: specify these at runtime according to manylinux_image
|
# TODO: specify these at runtime according to manylinux_image
|
||||||
project_with_manylinux_symbols = test_projects.new_c_project(
|
project_with_manylinux_symbols = test_projects.new_c_project(
|
||||||
spam_c_top_level_add=textwrap.dedent(
|
spam_c_top_level_add=textwrap.dedent(
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
from pathlib import Path
|
from __future__ import annotations
|
||||||
|
|
||||||
import packaging.utils
|
import packaging.utils
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
meson_project = test_projects.new_meson_project()
|
meson_project = test_projects.new_meson_project()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
project_with_manylinux_symbols = test_projects.new_c_project(
|
project_with_manylinux_symbols = test_projects.new_c_project(
|
||||||
spam_c_top_level_add=textwrap.dedent(
|
spam_c_top_level_add=textwrap.dedent(
|
||||||
r"""
|
r"""
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
basic_project = test_projects.new_c_project(
|
basic_project = test_projects.new_c_project(
|
||||||
setup_py_add=textwrap.dedent(
|
setup_py_add=textwrap.dedent(
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
from pathlib import Path
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Self
|
from typing import Any, Self
|
||||||
|
|
||||||
import jinja2
|
import jinja2
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
FilesDict = dict[str, str | jinja2.Template]
|
FilesDict = dict[str, str | jinja2.Template]
|
||||||
TemplateContext = dict[str, Any]
|
TemplateContext = dict[str, Any]
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -7,6 +9,10 @@ from test import test_projects
|
|||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
pure_python_project = test_projects.TestProject()
|
pure_python_project = test_projects.TestProject()
|
||||||
pure_python_project.files["setup.py"] = """
|
pure_python_project.files["setup.py"] = """
|
||||||
from setuptools import Extension, setup
|
from setuptools import Extension, setup
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -11,6 +12,10 @@ from cibuildwheel.util.file import CIBW_CACHE_PATH
|
|||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
pytestmark = pytest.mark.pyodide
|
pytestmark = pytest.mark.pyodide
|
||||||
|
|
||||||
CIBW_PLATFORM = os.environ.get("CIBW_PLATFORM", "pyodide")
|
CIBW_PLATFORM = os.environ.get("CIBW_PLATFORM", "pyodide")
|
||||||
|
|||||||
+6
-1
@@ -1,10 +1,15 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
project_with_ssl_tests = test_projects.new_c_project(
|
project_with_ssl_tests = test_projects.new_c_project(
|
||||||
setup_py_add=textwrap.dedent(
|
setup_py_add=textwrap.dedent(
|
||||||
r"""
|
r"""
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import jinja2
|
import jinja2
|
||||||
import pytest
|
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
from .test_projects import TestProject
|
from .test_projects import TestProject
|
||||||
from .test_projects.c import SPAM_C_TEMPLATE
|
from .test_projects.c import SPAM_C_TEMPLATE
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
import pytest
|
||||||
|
|
||||||
subdir_package_project = TestProject()
|
subdir_package_project = TestProject()
|
||||||
|
|
||||||
subdir_package_project.files["src/spam/spam.c"] = jinja2.Template(SPAM_C_TEMPLATE)
|
subdir_package_project.files["src/spam/spam.c"] = jinja2.Template(SPAM_C_TEMPLATE)
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
project_with_a_test = test_projects.new_c_project(
|
project_with_a_test = test_projects.new_c_project(
|
||||||
setup_cfg_add=textwrap.dedent(
|
setup_cfg_add=textwrap.dedent(
|
||||||
r"""
|
r"""
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
from .test_projects import TestProject, new_c_project
|
from .test_projects import TestProject, new_c_project
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
SO_FILE_WARNING = "NOTE: Shared object (.so) files found in this project."
|
SO_FILE_WARNING = "NOTE: Shared object (.so) files found in this project."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
from pathlib import Path
|
from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from . import test_projects, utils
|
from . import test_projects, utils
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
basic_project = test_projects.new_c_project()
|
basic_project = test_projects.new_c_project()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -4,11 +4,12 @@ Utility functions used by the cibuildwheel tests.
|
|||||||
This file is added to the PYTHONPATH in the test runner at bin/run_test.py.
|
This file is added to the PYTHONPATH in the test runner at bin/run_test.py.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import platform as pm
|
import platform as pm
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from collections.abc import Generator, Mapping, Sequence
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
from typing import Final
|
from typing import Final
|
||||||
@@ -20,6 +21,10 @@ from cibuildwheel.ci import CIProvider, detect_ci_provider
|
|||||||
from cibuildwheel.selector import EnableGroup
|
from cibuildwheel.selector import EnableGroup
|
||||||
from cibuildwheel.util.file import CIBW_CACHE_PATH
|
from cibuildwheel.util.file import CIBW_CACHE_PATH
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Generator, Mapping, Sequence
|
||||||
|
|
||||||
EMULATED_ARCHS: Final[list[str]] = sorted(
|
EMULATED_ARCHS: Final[list[str]] = sorted(
|
||||||
arch.value for arch in (Architecture.all_archs("linux") - Architecture.auto_archs("linux"))
|
arch.value for arch in (Architecture.all_archs("linux") - Architecture.auto_archs("linux"))
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import platform as platform_module
|
import platform as platform_module
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
@@ -6,7 +8,10 @@ import pytest
|
|||||||
|
|
||||||
import cibuildwheel.architecture
|
import cibuildwheel.architecture
|
||||||
from cibuildwheel.architecture import Architecture, arch_synonym
|
from cibuildwheel.architecture import Architecture, arch_synonym
|
||||||
from cibuildwheel.typing import PlatformName
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from cibuildwheel.typing import PlatformName
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import contextlib
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
@@ -8,6 +9,10 @@ import pytest
|
|||||||
from cibuildwheel import errors
|
from cibuildwheel import errors
|
||||||
from cibuildwheel.audit import needs_audit, run_audit
|
from cibuildwheel.audit import needs_audit, run_audit
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
import contextlib
|
||||||
|
|
||||||
|
|
||||||
def mock_virtualenv() -> contextlib.AbstractContextManager[Mock]:
|
def mock_virtualenv() -> contextlib.AbstractContextManager[Mock]:
|
||||||
return patch(
|
return patch(
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import ssl
|
import ssl
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import certifi
|
import certifi
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from cibuildwheel.util.file import download
|
from cibuildwheel.util.file import download
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
DOWNLOAD_URL = "https://cdn.jsdelivr.net/gh/pypa/cibuildwheel@v1.6.3/requirements-dev.txt"
|
DOWNLOAD_URL = "https://cdn.jsdelivr.net/gh/pypa/cibuildwheel@v1.6.3/requirements-dev.txt"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import sys
|
import sys
|
||||||
from collections.abc import Generator
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import setuptools._distutils.util
|
import setuptools._distutils.util
|
||||||
@@ -11,6 +11,9 @@ from cibuildwheel.errors import FatalError
|
|||||||
from cibuildwheel.platforms.windows import PythonConfiguration, setup_setuptools_cross_compile
|
from cibuildwheel.platforms.windows import PythonConfiguration, setup_setuptools_cross_compile
|
||||||
|
|
||||||
TYPE_CHECKING = False
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Generator
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# monkeypatching os.name is too flaky. E.g. It works on my machine, but fails in pipeline
|
# monkeypatching os.name is too flaky. E.g. It works on my machine, but fails in pipeline
|
||||||
if not sys.platform.startswith("win") and not TYPE_CHECKING:
|
if not sys.platform.startswith("win") and not TYPE_CHECKING:
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
import textwrap
|
from __future__ import annotations
|
||||||
from pathlib import Path
|
|
||||||
from pprint import pprint
|
|
||||||
|
|
||||||
import pytest
|
import textwrap
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
import cibuildwheel.platforms.linux
|
import cibuildwheel.platforms.linux
|
||||||
from cibuildwheel.oci_container import OCIContainerEngineConfig
|
from cibuildwheel.oci_container import OCIContainerEngineConfig
|
||||||
from cibuildwheel.options import CommandLineArguments, Options
|
from cibuildwheel.options import CommandLineArguments, Options
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def test_linux_container_split(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
def test_linux_container_split(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import cibuildwheel.__main__ as main_module
|
import cibuildwheel.__main__ as main_module
|
||||||
from cibuildwheel.__main__ import main
|
from cibuildwheel.__main__ import main
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def test_clean_cache_when_cache_exists(
|
def test_clean_cache_when_cache_exists(
|
||||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capfd: pytest.CaptureFixture[str]
|
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capfd: pytest.CaptureFixture[str]
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import platform as platform_module
|
import platform as platform_module
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from collections.abc import Generator, Iterator
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -13,6 +14,10 @@ from cibuildwheel.logger import Logger
|
|||||||
from cibuildwheel.platforms import android, ios, linux, macos, pyodide, windows
|
from cibuildwheel.platforms import android, ios, linux, macos, pyodide, windows
|
||||||
from cibuildwheel.util import file
|
from cibuildwheel.util import file
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Generator, Iterator
|
||||||
|
|
||||||
|
|
||||||
class ArgsInterceptor:
|
class ArgsInterceptor:
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import tomllib
|
import tomllib
|
||||||
from collections.abc import Mapping
|
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -16,6 +17,8 @@ from cibuildwheel.util.packaging import DependencyConstraints
|
|||||||
|
|
||||||
TYPE_CHECKING = False
|
TYPE_CHECKING = False
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Mapping
|
||||||
|
|
||||||
from .conftest import ArgsInterceptor
|
from .conftest import ArgsInterceptor
|
||||||
|
|
||||||
# CIBW_PLATFORM is tested in main_platform_test.py
|
# CIBW_PLATFORM is tested in main_platform_test.py
|
||||||
@@ -37,7 +40,7 @@ def test_old_free_threaded(
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("platform")
|
@pytest.mark.usefixtures("platform")
|
||||||
def test_output_dir(
|
def test_output_dir(
|
||||||
intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
||||||
) -> None:
|
) -> None:
|
||||||
OUTPUT_DIR = Path("some_output_dir")
|
OUTPUT_DIR = Path("some_output_dir")
|
||||||
|
|
||||||
@@ -49,7 +52,7 @@ def test_output_dir(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("platform")
|
@pytest.mark.usefixtures("platform")
|
||||||
def test_output_dir_default(intercepted_build_args: "ArgsInterceptor") -> None:
|
def test_output_dir_default(intercepted_build_args: ArgsInterceptor) -> None:
|
||||||
main()
|
main()
|
||||||
|
|
||||||
assert intercepted_build_args.args[0].globals.output_dir == Path("wheelhouse").resolve()
|
assert intercepted_build_args.args[0].globals.output_dir == Path("wheelhouse").resolve()
|
||||||
@@ -59,7 +62,7 @@ def test_output_dir_default(intercepted_build_args: "ArgsInterceptor") -> None:
|
|||||||
@pytest.mark.parametrize("also_set_environment", [False, True])
|
@pytest.mark.parametrize("also_set_environment", [False, True])
|
||||||
def test_output_dir_argument(
|
def test_output_dir_argument(
|
||||||
also_set_environment: bool,
|
also_set_environment: bool,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
OUTPUT_DIR = Path("some_output_dir")
|
OUTPUT_DIR = Path("some_output_dir")
|
||||||
@@ -75,7 +78,7 @@ def test_output_dir_argument(
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("platform", "allow_empty")
|
@pytest.mark.usefixtures("platform", "allow_empty")
|
||||||
def test_build_selector(
|
def test_build_selector(
|
||||||
intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
||||||
) -> None:
|
) -> None:
|
||||||
monkeypatch.setenv("CIBW_BUILD", "cp313-*")
|
monkeypatch.setenv("CIBW_BUILD", "cp313-*")
|
||||||
monkeypatch.setenv("CIBW_SKIP", "cp39-*")
|
monkeypatch.setenv("CIBW_SKIP", "cp39-*")
|
||||||
@@ -191,7 +194,7 @@ def test_manylinux_images(
|
|||||||
image: str | None,
|
image: str | None,
|
||||||
full_image: str,
|
full_image: str,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
if image is not None:
|
if image is not None:
|
||||||
@@ -230,7 +233,7 @@ def test_repair_command(
|
|||||||
repair_command: str | None,
|
repair_command: str | None,
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
if repair_command is not None:
|
if repair_command is not None:
|
||||||
@@ -259,7 +262,7 @@ def test_environment(
|
|||||||
environment: Mapping[str, str],
|
environment: Mapping[str, str],
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
env_string = " ".join(f"{k}={v}" for k, v in environment.items())
|
env_string = " ".join(f"{k}={v}" for k, v in environment.items())
|
||||||
@@ -284,7 +287,7 @@ def test_test_requires(
|
|||||||
test_requires: str | None,
|
test_requires: str | None,
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
if test_requires is not None:
|
if test_requires is not None:
|
||||||
@@ -307,7 +310,7 @@ def test_audit_requires(
|
|||||||
audit_requires: str | None,
|
audit_requires: str | None,
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
if audit_requires is not None:
|
if audit_requires is not None:
|
||||||
@@ -331,7 +334,7 @@ def test_test_extras(
|
|||||||
test_extras: str | None,
|
test_extras: str | None,
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
if test_extras is not None:
|
if test_extras is not None:
|
||||||
@@ -354,7 +357,7 @@ def test_test_command(
|
|||||||
test_command: str | None,
|
test_command: str | None,
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
if test_command is not None:
|
if test_command is not None:
|
||||||
@@ -377,7 +380,7 @@ def test_before_build(
|
|||||||
before_build: str | None,
|
before_build: str | None,
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
if before_build is not None:
|
if before_build is not None:
|
||||||
@@ -399,7 +402,7 @@ def test_build_verbosity(
|
|||||||
build_verbosity: int | None,
|
build_verbosity: int | None,
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
if build_verbosity is not None:
|
if build_verbosity is not None:
|
||||||
@@ -420,7 +423,7 @@ def test_build_verbosity(
|
|||||||
def test_config_settings(
|
def test_config_settings(
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
config_settings = (
|
config_settings = (
|
||||||
@@ -507,7 +510,7 @@ def test_before_all(
|
|||||||
before_all: str | None,
|
before_all: str | None,
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
if before_all is not None:
|
if before_all is not None:
|
||||||
@@ -533,7 +536,7 @@ def test_dependency_versions(
|
|||||||
dependency_versions: str | None,
|
dependency_versions: str | None,
|
||||||
platform_specific: bool,
|
platform_specific: bool,
|
||||||
platform: str,
|
platform: str,
|
||||||
intercepted_build_args: "ArgsInterceptor",
|
intercepted_build_args: ArgsInterceptor,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
tmp_path: Path,
|
tmp_path: Path,
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -593,7 +596,7 @@ def test_debug_traceback(
|
|||||||
|
|
||||||
@pytest.mark.parametrize("method", ["unset", "command_line", "env_var"])
|
@pytest.mark.parametrize("method", ["unset", "command_line", "env_var"])
|
||||||
def test_enable(
|
def test_enable(
|
||||||
method: str, intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
method: str, intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
||||||
) -> None:
|
) -> None:
|
||||||
monkeypatch.delenv("CIBW_ENABLE", raising=False)
|
monkeypatch.delenv("CIBW_ENABLE", raising=False)
|
||||||
|
|
||||||
@@ -613,7 +616,7 @@ def test_enable(
|
|||||||
|
|
||||||
|
|
||||||
def test_enable_all(
|
def test_enable_all(
|
||||||
intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
||||||
) -> None:
|
) -> None:
|
||||||
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "all"])
|
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "all"])
|
||||||
monkeypatch.delenv("CIBW_ENABLE", raising=False)
|
monkeypatch.delenv("CIBW_ENABLE", raising=False)
|
||||||
@@ -625,7 +628,7 @@ def test_enable_all(
|
|||||||
|
|
||||||
|
|
||||||
def test_enable_arg_inherits(
|
def test_enable_arg_inherits(
|
||||||
intercepted_build_args: "ArgsInterceptor", monkeypatch: pytest.MonkeyPatch
|
intercepted_build_args: ArgsInterceptor, monkeypatch: pytest.MonkeyPatch
|
||||||
) -> None:
|
) -> None:
|
||||||
monkeypatch.setenv("CIBW_ENABLE", "pypy graalpy")
|
monkeypatch.setenv("CIBW_ENABLE", "pypy graalpy")
|
||||||
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "cpython-prerelease"])
|
monkeypatch.setattr(sys, "argv", [*sys.argv, "--enable", "cpython-prerelease"])
|
||||||
@@ -652,7 +655,7 @@ def test_enable_arg_error_message(
|
|||||||
assert "Valid group names are:" in err
|
assert "Valid group names are:" in err
|
||||||
|
|
||||||
|
|
||||||
def test_defaults(platform: str, intercepted_build_args: "ArgsInterceptor") -> None:
|
def test_defaults(platform: str, intercepted_build_args: ArgsInterceptor) -> None:
|
||||||
main()
|
main()
|
||||||
|
|
||||||
build_options: BuildOptions = intercepted_build_args.args[0].build_options(identifier=None)
|
build_options: BuildOptions = intercepted_build_args.args[0].build_options(identifier=None)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@@ -5,10 +7,14 @@ import pytest
|
|||||||
from cibuildwheel.__main__ import main
|
from cibuildwheel.__main__ import main
|
||||||
from cibuildwheel.architecture import Architecture
|
from cibuildwheel.architecture import Architecture
|
||||||
from cibuildwheel.selector import EnableGroup
|
from cibuildwheel.selector import EnableGroup
|
||||||
from cibuildwheel.typing import PlatformName
|
|
||||||
|
|
||||||
from ..conftest import MOCK_PACKAGE_DIR
|
from ..conftest import MOCK_PACKAGE_DIR
|
||||||
from .conftest import ArgsInterceptor
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from cibuildwheel.typing import PlatformName
|
||||||
|
|
||||||
|
from .conftest import ArgsInterceptor
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("option_value", [None, "auto", ""])
|
@pytest.mark.parametrize("option_value", [None, "auto", ""])
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from packaging.specifiers import SpecifierSet
|
from packaging.specifiers import SpecifierSet
|
||||||
|
|
||||||
from cibuildwheel.__main__ import main
|
from cibuildwheel.__main__ import main
|
||||||
|
|
||||||
from .conftest import ArgsInterceptor
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from .conftest import ArgsInterceptor
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@@ -7,7 +9,6 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
from collections.abc import Iterator
|
|
||||||
from contextlib import nullcontext
|
from contextlib import nullcontext
|
||||||
from pathlib import Path, PurePath, PurePosixPath
|
from pathlib import Path, PurePath, PurePosixPath
|
||||||
|
|
||||||
@@ -25,6 +26,10 @@ from cibuildwheel.oci_container import (
|
|||||||
_check_engine_version,
|
_check_engine_version,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Iterator
|
||||||
|
|
||||||
# Test utilities
|
# Test utilities
|
||||||
|
|
||||||
# for these tests we use manylinux2014 images, because they're available on
|
# for these tests we use manylinux2014 images, because they're available on
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import platform as platform_module
|
import platform as platform_module
|
||||||
import textwrap
|
import textwrap
|
||||||
import unittest.mock
|
import unittest.mock
|
||||||
from collections.abc import Sequence
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
@@ -25,6 +26,10 @@ from cibuildwheel.platforms import ALL_PLATFORM_MODULES, get_build_identifiers
|
|||||||
from cibuildwheel.util import resources
|
from cibuildwheel.util import resources
|
||||||
from cibuildwheel.util.packaging import DependencyConstraints
|
from cibuildwheel.util.packaging import DependencyConstraints
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Sequence
|
||||||
|
|
||||||
PYPROJECT_1 = """
|
PYPROJECT_1 = """
|
||||||
[tool.cibuildwheel]
|
[tool.cibuildwheel]
|
||||||
build = ["cp38-*", "cp313-*"]
|
build = ["cp38-*", "cp313-*"]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import shlex
|
import shlex
|
||||||
from pathlib import Path
|
|
||||||
from typing import Any, cast
|
from typing import Any, cast
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@@ -13,7 +14,12 @@ from cibuildwheel.options import (
|
|||||||
ShlexTableFormat,
|
ShlexTableFormat,
|
||||||
_resolve_cascade,
|
_resolve_cascade,
|
||||||
)
|
)
|
||||||
from cibuildwheel.typing import PlatformName
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from cibuildwheel.typing import PlatformName
|
||||||
|
|
||||||
PYPROJECT_1 = """
|
PYPROJECT_1 = """
|
||||||
[tool.cibuildwheel]
|
[tool.cibuildwheel]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import tomllib
|
import tomllib
|
||||||
from pathlib import Path
|
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@@ -10,6 +11,10 @@ from cibuildwheel.projectfiles import (
|
|||||||
setup_py_python_requires,
|
setup_py_python_requires,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
TYPE_CHECKING = False
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def test_read_setup_py_simple(tmp_path: Path) -> None:
|
def test_read_setup_py_simple(tmp_path: Path) -> None:
|
||||||
with open(tmp_path / "setup.py", "w") as f:
|
with open(tmp_path / "setup.py", "w") as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user