-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6aff4ed
commit 53d8a7c
Showing
13 changed files
with
144 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
crates/pixi-build/src/bin/pixi-build-python/build_script.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% set PYTHON="%PYTHON%" if build_platform == "windows" else "$PYTHON" -%} | ||
{% set SRC_DIR="%SRC_DIR%" if build_platform == "windows" else "$SRC_DIR" -%} | ||
|
||
{% if installer == "uv" -%} | ||
uv pip install --python {{ PYTHON }} -vv --no-deps --no-build-isolation {{ SRC_DIR }} | ||
{% else %} | ||
{{ PYTHON }} -m pip install -vv --ignore-installed --no-deps --no-build-isolation {{ SRC_DIR }} | ||
{% endif -%} | ||
|
||
{% if build_platform == "windows" -%} | ||
if errorlevel 1 exit 1 | ||
{% endif %} |
43 changes: 43 additions & 0 deletions
43
crates/pixi-build/src/bin/pixi-build-python/build_script.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use minijinja::Environment; | ||
use serde::Serialize; | ||
|
||
#[derive(Serialize)] | ||
pub struct BuildScriptContext { | ||
pub installer: Installer, | ||
pub build_platform: BuildPlatform, | ||
} | ||
|
||
#[derive(Default, Serialize)] | ||
#[serde(rename_all = "kebab-case")] | ||
pub enum Installer { | ||
Uv, | ||
#[default] | ||
Pip, | ||
} | ||
|
||
impl Installer { | ||
pub fn package_name(&self) -> &str { | ||
match self { | ||
Installer::Uv => "uv", | ||
Installer::Pip => "pip", | ||
} | ||
} | ||
} | ||
|
||
#[derive(Serialize)] | ||
#[serde(rename_all = "kebab-case")] | ||
pub enum BuildPlatform { | ||
Windows, | ||
Unix, | ||
} | ||
|
||
impl BuildScriptContext { | ||
pub fn render(&self) -> Vec<String> { | ||
let env = Environment::new(); | ||
let template = env | ||
.template_from_str(include_str!("build_script.j2")) | ||
.unwrap(); | ||
let rendered = template.render(self).unwrap().to_string(); | ||
rendered.split("\n").map(|s| s.to_string()).collect() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
mod build_script; | ||
mod python; | ||
|
||
use python::PythonBuildBackend; | ||
|
||
#[tokio::main] | ||
pub async fn main() { | ||
if let Err(err) = pixi_build_backend::cli::main(PythonBuildBackend::factory).await { | ||
eprintln!("{err:?}"); | ||
std::process::exit(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub mod cli; | ||
pub mod protocol; | ||
pub mod server; | ||
|
||
mod consts; | ||
pub mod utils; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod temporary_recipe; | ||
|
||
pub use temporary_recipe::TemporaryRenderedRecipe; |
File renamed without changes.