mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
respect env var UV_BINARY with OFFLINE_BUILD being set (#4170)
* respect env var UV_BINARY with OFFLINE_BUILD being set * cleanup formatting, fix import * Fix build error (dae)
This commit is contained in:
parent
b16439fc9c
commit
b205008a5e
1 changed files with 16 additions and 7 deletions
|
@ -1,8 +1,6 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use std::env;
|
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ninja_gen::action::BuildAction;
|
use ninja_gen::action::BuildAction;
|
||||||
use ninja_gen::archives::Platform;
|
use ninja_gen::archives::Platform;
|
||||||
|
@ -125,7 +123,14 @@ impl BuildAction for BuildWheel {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn files(&mut self, build: &mut impl FilesHandle) {
|
fn files(&mut self, build: &mut impl FilesHandle) {
|
||||||
|
if std::env::var("OFFLINE_BUILD").ok().as_deref() == Some("1") {
|
||||||
|
let uv_path =
|
||||||
|
std::env::var("UV_BINARY").expect("UV_BINARY must be set in OFFLINE_BUILD mode");
|
||||||
|
build.add_inputs("uv", inputs![uv_path]);
|
||||||
|
} else {
|
||||||
build.add_inputs("uv", inputs![":uv_binary"]);
|
build.add_inputs("uv", inputs![":uv_binary"]);
|
||||||
|
}
|
||||||
|
|
||||||
build.add_inputs("", &self.deps);
|
build.add_inputs("", &self.deps);
|
||||||
|
|
||||||
// Set the project directory based on which package we're building
|
// Set the project directory based on which package we're building
|
||||||
|
@ -222,15 +227,19 @@ struct Sphinx {
|
||||||
|
|
||||||
impl BuildAction for Sphinx {
|
impl BuildAction for Sphinx {
|
||||||
fn command(&self) -> &str {
|
fn command(&self) -> &str {
|
||||||
if env::var("OFFLINE_BUILD").is_err() {
|
if std::env::var("OFFLINE_BUILD").ok().as_deref() == Some("1") {
|
||||||
"$uv sync --extra sphinx && $python python/sphinx/build.py"
|
|
||||||
} else {
|
|
||||||
"$python python/sphinx/build.py"
|
"$python python/sphinx/build.py"
|
||||||
|
} else {
|
||||||
|
"$uv sync --extra sphinx && $python python/sphinx/build.py"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn files(&mut self, build: &mut impl FilesHandle) {
|
fn files(&mut self, build: &mut impl FilesHandle) {
|
||||||
if env::var("OFFLINE_BUILD").is_err() {
|
if std::env::var("OFFLINE_BUILD").ok().as_deref() == Some("1") {
|
||||||
|
let uv_path =
|
||||||
|
std::env::var("UV_BINARY").expect("UV_BINARY must be set in OFFLINE_BUILD mode");
|
||||||
|
build.add_inputs("uv", inputs![uv_path]);
|
||||||
|
} else {
|
||||||
build.add_inputs("uv", inputs![":uv_binary"]);
|
build.add_inputs("uv", inputs![":uv_binary"]);
|
||||||
// Set environment variable to use the existing pyenv
|
// Set environment variable to use the existing pyenv
|
||||||
build.add_variable("pyenv_path", "$builddir/pyenv");
|
build.add_variable("pyenv_path", "$builddir/pyenv");
|
||||||
|
|
Loading…
Reference in a new issue