fix: minor 4.0 issues in Android validation, docs, and docstring (#2891)
* fix: minor 4.0 issues in android validation, docs, and docstring - android: raise a clear FatalError when ANDROID_API_LEVEL is not an integer, instead of an uncaught ValueError deep in localized_vars - docs: note that delvewheel is the default Windows repair-wheel-command since 4.0 and how to skip it for platform-tagged wheels with no extension module; update the now-outdated FAQ wording - venv: fix _parse_pip_constraint_for_virtualenv docstring to say marker-bearing constraints are evaluated against the host's default environment (not skipped) when marker_env is None Assisted-by: ClaudeCode:claude-opus-4.8 * fix: use int() with original error for ANDROID_API_LEVEL validation Handle ANDROID_API_LEVEL validation via try/except around int() so the original exception message is surfaced, and so non-ASCII Unicode digits (which isdigit() accepts but int() may reject) are handled correctly. Assisted-by: ClaudeCode:claude-opus-4.8 * refactor: address reivew by moving error catch Assisted-by: ClaudeCode:claude-opus-4.8 Signed-off-by: Henry Schreiner <henryfs@princeton.edu> --------- Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
This commit is contained in:
@@ -349,7 +349,11 @@ def localized_vars(
|
||||
final = final.replace(orig_prefix, str(prefix))
|
||||
|
||||
if key == "ANDROID_API_LEVEL":
|
||||
final = int(build_env[key])
|
||||
try:
|
||||
final = int(build_env[key])
|
||||
except ValueError as e:
|
||||
msg = f"ANDROID_API_LEVEL: {e}. This variable must be an integer."
|
||||
raise errors.FatalError(msg) from e
|
||||
|
||||
# Build systems vary in whether FLAGS variables are read from sysconfig, and if so,
|
||||
# whether they're replaced by environment variables or combined with them. Even
|
||||
|
||||
@@ -84,7 +84,7 @@ def _parse_pip_constraint_for_virtualenv(
|
||||
If it can't get an exact version, the real constraint will be handled by the
|
||||
{macos|windows}.setup_python function.
|
||||
If marker_env is provided, marker-bearing constraints are evaluated against it;
|
||||
otherwise, marker-bearing constraints are skipped.
|
||||
otherwise, they are evaluated against the host's default environment.
|
||||
"""
|
||||
env: dict[str, str] = (
|
||||
marker_env if marker_env is not None else cast("dict[str, str]", default_environment())
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ Sometimes a build will fail due to a missing dependency.
|
||||
|
||||
**If you need a build tool** (e.g. cmake, automake, ninja), you can install it through a package manager like apt/yum, brew or choco, using the [`before-all`](options.md#before-all) option.
|
||||
|
||||
**If your build is linking into a native library dependency**, you can build/install that in [`before-all`](options.md#before-all). However, on Linux, Mac (and Windows if you're using [delvewheel]), the library that you install will be bundled into the wheel in the [repair step]. So take care to ensure that
|
||||
**If your build is linking into a native library dependency**, you can build/install that in [`before-all`](options.md#before-all). However, on Linux, Mac, and Windows (which uses [delvewheel] by default since cibuildwheel 4.0), the library that you install will be bundled into the wheel in the [repair step]. So take care to ensure that
|
||||
|
||||
- the bundled library doesn't accidentally increase the minimum system requirements (such as the minimum macOS version)
|
||||
- the bundled library matches the architecture of the wheel you're building when cross-compiling
|
||||
|
||||
@@ -971,6 +971,9 @@ Default:
|
||||
A shell command to repair a built wheel by copying external library dependencies into the wheel tree and relinking them.
|
||||
The command is run on each built wheel (except for pure Python ones) before testing it.
|
||||
|
||||
!!! note
|
||||
Since cibuildwheel 4.0, `delvewheel` is the default `repair-wheel-command` on Windows, so extension-module DLLs are bundled automatically. If a wheel has a platform tag but contains no extension module (for example, a package that sets a platform tag but ships a pre-built DLL itself), `delvewheel` may error. In that case, set `repair-wheel-command = ""` to skip the repair step.
|
||||
|
||||
The following placeholders must be used inside the command and will be replaced by cibuildwheel:
|
||||
|
||||
- `{wheel}` for the absolute path to the built wheel
|
||||
|
||||
Reference in New Issue
Block a user