From 5d6310f28c56e498bd8e2130b8921084b1145de3 Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Tue, 21 Apr 2026 18:58:17 +0300 Subject: [PATCH] fix(android): make wheels find-links URL work on Linux CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- android/app/build.gradle.kts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 4dc9b41..3472d4e 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -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