Skip to content

Commit

Permalink
Merge branch 'main' into test/pypi-installation
Browse files Browse the repository at this point in the history
  • Loading branch information
tdejager authored Dec 3, 2024
2 parents 5f95ec4 + d4f0dd7 commit 5d80cad
Show file tree
Hide file tree
Showing 63 changed files with 545 additions and 129 deletions.
13 changes: 11 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async-fd-lock = "0.2.0"
async-once-cell = "0.5.3"
async-trait = "0.1.82"
base64 = "0.22.1"
bytes = "1.9.0"
chrono = "0.4.38"
clap = { version = "4.5.9", default-features = false }
clap-verbosity-flag = "2.2.0"
Expand Down Expand Up @@ -86,6 +87,7 @@ tar = "0.4.40"
tempfile = "3.10.1"
thiserror = "1.0.58"
tokio = "1.37.0"
tokio-stream = "0.1.16"
tokio-util = "0.7.10"
toml_edit = "0.22.11"
tracing = "0.1.40"
Expand Down
21 changes: 21 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,24 @@ ignore-interior-mutability = [
"pixi::project::environment::Environment",
"pixi::project::solve_group::SolveGroup",
]

disallowed-methods = [
"std::fs::canonicalize",
"std::fs::copy",
"std::fs::create_dir",
"std::fs::create_dir_all",
"std::fs::hard_link",
"std::fs::metadata",
"std::fs::read",
"std::fs::read_dir",
"std::fs::read_link",
"std::fs::read_to_string",
"std::fs::remove_dir",
"std::fs::remove_dir_all",
"std::fs::remove_file",
"std::fs::rename",
"std::fs::set_permissions",
"std::fs::soft_link",
"std::fs::symlink_metadata",
"std::fs::write",
]
5 changes: 5 additions & 0 deletions crates/pixi_build_frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ version = "0.1.0"

[dependencies]
dashmap = { workspace = true }
fs-err = { workspace = true }
futures = { workspace = true }
itertools = { workspace = true }
jsonrpsee = { workspace = true, features = ["client"] }
Expand Down Expand Up @@ -43,7 +44,9 @@ which = { workspace = true }

pixi_build_types = { path = "../pixi_build_types" }


[dev-dependencies]
bytes = { workspace = true }
insta = { workspace = true, features = ["yaml", "filters"] }
rstest = { workspace = true }
tempfile = { workspace = true }
Expand All @@ -52,3 +55,5 @@ tokio = { workspace = true, features = [
"io-std",
"rt-multi-thread",
] }
tokio-stream = { workspace = true }
tokio-util = { workspace = true, features = ["io"] }
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ mod test {
#[case::pinject("conda-render/pinject.txt")]
#[case::microarch("conda-render/microarch-level.txt")]
fn test_extract_rendered_recipe(#[case] path: &str) {
let rendered_recipe = std::fs::read_to_string(
let rendered_recipe = fs_err::read_to_string(
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("test-data")
.join(path),
Expand Down
31 changes: 27 additions & 4 deletions crates/pixi_build_frontend/src/protocols/builders/pixi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use miette::Diagnostic;
use pixi_consts::consts;
use pixi_manifest::{Manifest, PackageManifest, PrioritizedChannel, WorkspaceManifest};
use rattler_conda_types::{ChannelConfig, MatchSpec};
use serde::{de::IntoDeserializer, Deserialize};
use thiserror::Error;
use which::Error;

Expand Down Expand Up @@ -78,16 +79,16 @@ impl ProtocolBuilder {
manifest_path: PathBuf,
workspace_manifest: WorkspaceManifest,
package_manifest: PackageManifest,
) -> Result<Self, ProtocolBuildError> {
Ok(Self {
) -> Self {
Self {
source_dir,
manifest_path,
workspace_manifest,
package_manifest,
override_backend_spec: None,
channel_config: None,
cache_dir: None,
})
}
}

/// Sets an optional backend override.
Expand Down Expand Up @@ -128,7 +129,7 @@ impl ProtocolBuilder {
manifest_path,
manifest.workspace,
package_manifest,
)?;
);
return Ok(Some(builder));
}
Err(e) => {
Expand Down Expand Up @@ -195,9 +196,20 @@ impl ProtocolBuilder {
.await
.map_err(FinishError::Tool)?;

let configuration = self
.package_manifest
.build_system
.build_backend
.additional_args
.map_or(serde_json::Value::Null, |value| {
let deserializer = value.into_deserializer();
serde_json::Value::deserialize(deserializer).unwrap_or(serde_json::Value::Null)
});

Ok(JsonRPCBuildProtocol::setup(
self.source_dir,
self.manifest_path,
configuration,
build_id,
self.cache_dir,
tool,
Expand All @@ -212,10 +224,21 @@ impl ProtocolBuilder {
ipc: InProcessBackend,
build_id: usize,
) -> Result<JsonRPCBuildProtocol, FinishError> {
let configuration = self
.package_manifest
.build_system
.build_backend
.additional_args
.map_or(serde_json::Value::Null, |value| {
let deserializer = value.into_deserializer();
serde_json::Value::deserialize(deserializer).unwrap_or(serde_json::Value::Null)
});

Ok(JsonRPCBuildProtocol::setup_with_transport(
"<IPC>".to_string(),
self.source_dir,
self.manifest_path,
configuration,
build_id,
self.cache_dir,
Sender::from(ipc.rpc_out),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ impl ProtocolBuilder {
Ok(JsonRPCBuildProtocol::setup(
self.source_dir,
self.recipe_dir.join("recipe.yaml"),
serde_json::Value::Null,
build_id,
self.cache_dir,
tool,
Expand Down
4 changes: 4 additions & 0 deletions crates/pixi_build_frontend/src/protocols/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ impl JsonRPCBuildProtocol {
async fn setup(
source_dir: PathBuf,
manifest_path: PathBuf,
configuration: serde_json::Value,
build_id: usize,
cache_dir: Option<PathBuf>,
tool: Tool,
Expand Down Expand Up @@ -177,6 +178,7 @@ impl JsonRPCBuildProtocol {
backend_identifier,
source_dir,
manifest_path,
configuration,
build_id,
cache_dir,
tx,
Expand All @@ -193,6 +195,7 @@ impl JsonRPCBuildProtocol {
source_dir: PathBuf,
// In case of rattler-build it's recipe.yaml
manifest_path: PathBuf,
configuration: serde_json::Value,
build_id: usize,
cache_dir: Option<PathBuf>,
sender: impl TransportSenderT + Send,
Expand All @@ -212,6 +215,7 @@ impl JsonRPCBuildProtocol {
manifest_path: manifest_path.clone(),
capabilities: FrontendCapabilities {},
cache_directory: cache_dir,
configuration,
}),
)
.await
Expand Down
Loading

0 comments on commit 5d80cad

Please sign in to comment.