name: Run Ruff (lint) on Tools/peg_generator/
args: [--exit-non-zero-on-fix, --config=Tools/peg_generator/.ruff.toml]
files: ^Tools/peg_generator/
+ - id: ruff-check
+ name: Run Ruff (lint) on Tools/wasm/
+ args: [--exit-non-zero-on-fix, --config=Tools/wasm/.ruff.toml]
+ files: ^Tools/wasm/
- id: ruff-format
name: Run Ruff (format) on Doc/
args: [--check]
]
ignore = [
"E501", # Line too long
- "F541", # f-string without any placeholders
- "PYI024", # Use `typing.NamedTuple` instead of `collections.namedtuple`
- "PYI025", # Use `from collections.abc import Set as AbstractSet`
]
import argparse
import contextlib
import functools
+import hashlib
import os
import shutil
import subprocess
import sys
import sysconfig
-import hashlib
import tempfile
-from urllib.request import urlopen
from pathlib import Path
from textwrap import dedent
+from urllib.request import urlopen
try:
from os import process_cpu_count as cpu_count
PREFIX_DIR = CROSS_BUILD_DIR / HOST_TRIPLE / "prefix"
LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local"
-LOCAL_SETUP_MARKER = "# Generated by Tools/wasm/emscripten.py\n".encode(
- "utf-8"
-)
+LOCAL_SETUP_MARKER = b"# Generated by Tools/wasm/emscripten.py\n"
def updated_env(updates={}):
make_build,
configure_host,
make_host,
+ clean,
):
subcommand.add_argument(
"--quiet",
import sys
import sysconfig
import zipfile
-from typing import Dict
# source directory
SRCDIR = pathlib.Path(__file__).parents[3].absolute()
pzf.writepy(entry, filterfunc=filterfunc)
-def detect_extension_modules(args: argparse.Namespace) -> Dict[str, bool]:
+def detect_extension_modules(args: argparse.Namespace) -> dict[str, bool]:
modules = {}
# disabled by Modules/Setup.local ?
# disabled by configure?
with open(args.sysconfig_data) as f:
data = f.read()
- loc: Dict[str, Dict[str, str]] = {}
+ loc: dict[str, dict[str, str]] = {}
exec(data, globals(), loc)
for key, value in loc["build_time_vars"].items():
import sysconfig
import tempfile
-
CHECKOUT = pathlib.Path(__file__).parent.parent.parent.parent
assert (CHECKOUT / "configure").is_file(), (
"Please update the location of the file"
LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local"
LOCAL_SETUP_MARKER = (
- "# Generated by Tools/wasm/wasi .\n"
- "# Required to statically build extension modules."
-).encode("utf-8")
+ b"# Generated by Tools/wasm/wasi .\n"
+ b"# Required to statically build extension modules."
+)
WASI_SDK_VERSION = 24
test = "import sys, test.support; sys.exit(test.support.Py_DEBUG)"
result = subprocess.run(
[build_python_path(), "-c", test],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
+ capture_output=True,
)
return bool(result.returncode)