Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/pixi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ uv-configuration = { workspace = true }
uv-installer = { workspace = true }
uv-pep508 = { workspace = true }
uv-python = { workspace = true }
zip = { workspace = true }

[[test]]
name = "integration_rust"
Expand Down
1 change: 1 addition & 0 deletions tests/integration_rust/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod builders;
pub mod client;
pub mod logging;
pub mod package_database;
pub mod pypi_index;

use std::{
ffi::OsString,
Expand Down
25 changes: 23 additions & 2 deletions tests/integration_rust/common/package_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use chrono::{DateTime, Utc};
use itertools::Itertools;
use miette::IntoDiagnostic;
use rattler_conda_types::{
ChannelInfo, PackageName, PackageRecord, Platform, RepoData, VersionWithSource,
ChannelInfo, PackageName, PackageRecord, PackageUrl, Platform, RepoData, VersionWithSource,
package::ArchiveType,
};
use std::{collections::HashSet, path::Path};
Expand Down Expand Up @@ -146,6 +146,7 @@ pub struct PackageBuilder {
timestamp: Option<DateTime<Utc>>,
md5: Option<String>,
sha256: Option<String>,
purls: Option<std::collections::BTreeSet<PackageUrl>>,
}

impl Package {
Expand All @@ -162,6 +163,7 @@ impl Package {
timestamp: None,
sha256: None,
md5: None,
purls: None,
}
}

Expand Down Expand Up @@ -208,6 +210,25 @@ impl PackageBuilder {
self
}

/// Attach a PyPI purl for this conda package so Pixi treats it as a Python package.
/// The version used will be the conda record version (fallback if purl has none).
pub fn with_pypi_purl(mut self, pypi_name: impl AsRef<str>) -> Self {
let purl = PackageUrl::builder(String::from("pypi"), pypi_name.as_ref().to_string())
.build()
.expect("valid pypi package url");
match &mut self.purls {
Some(v) => {
v.insert(purl);
}
None => {
let mut s = std::collections::BTreeSet::new();
s.insert(purl);
self.purls = Some(s);
}
}
self
}

/// Sets the timestamp of the package.
pub fn with_timestamp(mut self, timestamp: DateTime<Utc>) -> Self {
self.timestamp = Some(timestamp);
Expand Down Expand Up @@ -272,7 +293,7 @@ impl PackageBuilder {
timestamp: self.timestamp,
track_features: vec![],
version: self.version,
purls: None,
purls: self.purls,
run_exports: None,
python_site_packages_path: None,
experimental_extra_depends: Default::default(),
Expand Down
Loading
Loading