fix(android): make wheels find-links URL work on Linux CI
Lint & Test / test (push) Successful in 3m31s
Lint & Test / test (push) Successful in 3m31s
Chaquopy's pip --find-links argument was built with a hard-coded "file:///" prefix plus rootDir.absolutePath. That works on Windows (paths start with "C:/...", so prefix + path produces three slashes after "file:") but breaks on Linux (paths start with "/workspace/...", so prefix + path produces four slashes — pip then parses "workspace" as the URL's hostname and aborts with "ValueError: non-local file URIs are not supported on this platform". Pick the prefix based on whether the absolute path already starts with "/", so we always end up with exactly three slashes between "file:" and the drive letter or root.
This commit is contained in:
@@ -119,9 +119,17 @@ chaquopy {
|
||||
version = "3.11"
|
||||
|
||||
pip {
|
||||
// Pre-built wheels directory (for pydantic-core etc.)
|
||||
// Must use absolute file:// URI with forward slashes
|
||||
options("--find-links", "file:///${rootDir.absolutePath.replace("\\", "/")}/wheels/")
|
||||
// Pre-built wheels directory (for pydantic-core etc.) as an
|
||||
// absolute file:// URI with forward slashes. Pip requires
|
||||
// exactly three slashes after `file:` for an empty-host local
|
||||
// path; the path-normalization differs by platform:
|
||||
// Windows: absolute path is "C:/..." → prefix "file:///"
|
||||
// Linux: absolute path is "/..." → prefix "file://"
|
||||
// Using a fixed "file:///" prefix on both made CI produce
|
||||
// "file:////workspace/…", which pip rejects as non-local.
|
||||
val wheelsPath = rootDir.absolutePath.replace("\\", "/")
|
||||
val wheelsUrlPrefix = if (wheelsPath.startsWith("/")) "file://" else "file:///"
|
||||
options("--find-links", "$wheelsUrlPrefix$wheelsPath/wheels/")
|
||||
|
||||
// ── Android-compatible dependencies ─────────────────
|
||||
// Listed explicitly because pyproject.toml includes
|
||||
|
||||
Reference in New Issue
Block a user