Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for optional dependencies #1019

Merged
merged 70 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
21d3d3e
Updating the parser to parse `Matchspec` with features and adding opt…
prsabahrami Jan 8, 2025
73de02e
Adding the package with different features to all-requirements.
prsabahrami Jan 8, 2025
187cc92
Run fmt
prsabahrami Jan 8, 2025
2141a10
Add separate features as separate packages
prsabahrami Jan 9, 2025
cd6347c
Add optional_dependencies to to repodata query
prsabahrami Jan 9, 2025
964f896
Remove the new snapshots and update the previous ones
prsabahrami Jan 9, 2025
4653c79
Create new MatchSpec instead of parsing the main package along with m…
prsabahrami Jan 9, 2025
0d56281
Add support for packages with optional_features as as dependencis
prsabahrami Jan 9, 2025
08431ca
Remove extra repodata used for testing
prsabahrami Jan 9, 2025
59a99be
Refactor parse_match_spec from Vec<VersionSetId> to VersionSetId.
prsabahrami Jan 9, 2025
44c381b
Refactor PackageName into enum of PackageNameWithFeature and PackageN…
prsabahrami Jan 9, 2025
6b11582
Revert "Refactor PackageName into enum of PackageNameWithFeature and …
prsabahrami Jan 9, 2025
3031f38
Switch from String to `NameType` to handle names with features
prsabahrami Jan 9, 2025
7e1a48a
update resolvo/mod.rs
prsabahrami Jan 10, 2025
f699c64
Fix conda_package_data to ensure optional_depends is included in the …
prsabahrami Jan 10, 2025
afa26a5
Updated snapshots
prsabahrami Jan 10, 2025
19913c5
Replace `optional_features` with `SolverMatchSpec::feature`
prsabahrami Jan 13, 2025
73e9c46
Update the From function to set features as None initially
prsabahrami Jan 13, 2025
4944c64
Add with_feature_ref to SolverMatchSpec and use to find the requireme…
prsabahrami Jan 13, 2025
964733b
Fix transaction prints to include the feature name.
prsabahrami Jan 14, 2025
33bc371
Add basic tests
prsabahrami Jan 14, 2025
d464463
Merge branch 'main' into feature_optional_depends
prsabahrami Jan 14, 2025
83d10c3
Fix issues in py-rattler
prsabahrami Jan 15, 2025
36a47b4
Add BTreeMap import
prsabahrami Jan 15, 2025
b98a579
Fix lint issues in py-rattler
prsabahrami Jan 15, 2025
8e62135
Add tests
prsabahrami Jan 15, 2025
61687ba
remove extra snapshots
prsabahrami Jan 15, 2025
cb75de6
grate the feature
prsabahrami Jan 15, 2025
5814675
bring the import under feature flag
prsabahrami Jan 15, 2025
d90c8f7
Add the tests under the feature flag
prsabahrami Jan 15, 2025
cac30de
Add the tests under feature flag
prsabahrami Jan 15, 2025
0307d9e
Remove extra `From<String> for StringMatcher`
prsabahrami Jan 16, 2025
c34e4ee
Change the return type of the solve function to a `HashMap` of `RepoD…
prsabahrami Jan 16, 2025
552103a
Add missing import
prsabahrami Jan 16, 2025
8896bc0
Fix python issues
prsabahrami Jan 16, 2025
f19eaa0
run fmt
prsabahrami Jan 16, 2025
1d20b45
fix lint errors
prsabahrami Jan 16, 2025
5a6885d
run fmt
prsabahrami Jan 16, 2025
ff1c021
Replace HashMap with IndexMap to preserve the order
prsabahrami Jan 16, 2025
999a768
Update crates/rattler_conda_types/src/match_spec/parse.rs
prsabahrami Jan 16, 2025
66239bf
move the import to the parse function
prsabahrami Jan 16, 2025
3e7bad6
Merge branch 'feature_optional_depends' of github.com:prsabahrami/rat…
prsabahrami Jan 16, 2025
b1f477f
update the solver return type
prsabahrami Jan 16, 2025
93fe642
update `with_feature_ref` function to `set_feature`
prsabahrami Jan 16, 2025
c76fcf5
update `NameType` struct
prsabahrami Jan 16, 2025
2bc89ee
update `parse_match_spec_cache` to cache all of the specs
prsabahrami Jan 16, 2025
68f9b9a
update the ci to test experimental features as well
prsabahrami Jan 16, 2025
ac0a9d7
run fmt
prsabahrami Jan 16, 2025
f4d5dd0
update the tests
prsabahrami Jan 17, 2025
7356302
Update the tests
prsabahrami Jan 17, 2025
3bde1ab
Update py-rattler/solver.rs
prsabahrami Jan 17, 2025
0fa69ea
fix solver.rs and replace Hashmap with Vec
prsabahrami Jan 17, 2025
ef77099
replace `optional_features` with `extras`
prsabahrami Jan 22, 2025
09b16ae
Merge branch 'main' into feature_optional_depends
prsabahrami Jan 22, 2025
8d051d5
run fmt
prsabahrami Jan 22, 2025
0f6a82b
Update rust-compile.yml
prsabahrami Jan 22, 2025
e79beb3
update the extras parser and add tests
prsabahrami Jan 22, 2025
7d7b356
Update mod.rs
prsabahrami Jan 23, 2025
28e52ff
Error out if extras is used with libsolv
prsabahrami Jan 23, 2025
9e976c9
Merge branch 'feature_optional_depends' of github.com:prsabahrami/rat…
prsabahrami Jan 23, 2025
73868cd
rename feature name to `experimental_extras`
prsabahrami Jan 23, 2025
1436ce0
run fmt
prsabahrami Jan 23, 2025
ef7da73
Update feature flag from `extras` to `experimental_extras` in parse.rs
prsabahrami Jan 23, 2025
e7d603c
Refactor MatchSpec display to format extras correctly
prsabahrami Jan 23, 2025
342c1f9
Refactor optional dependencies to use `extra_depends` instead of `opt…
prsabahrami Jan 23, 2025
2f129b9
update the parser and add failing tests
prsabahrami Jan 23, 2025
af17aee
add more versions of foo that provide the extra with-bar
prsabahrami Jan 24, 2025
1a2f2d0
update the snapshot
prsabahrami Jan 24, 2025
7cbcfaa
remove extra snapshots
prsabahrami Jan 24, 2025
b373841
Merge branch 'main' into feature_optional_depends
prsabahrami Jan 24, 2025
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
2 changes: 1 addition & 1 deletion crates/rattler_conda_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub mod prefix_record;
#[cfg(test)]
use std::path::{Path, PathBuf};

pub use build_spec::{BuildNumber, BuildNumberSpec, ParseBuildNumberSpecError};
pub use build_spec::{BuildNumber, BuildNumberSpec, OrdOperator, ParseBuildNumberSpecError};
pub use channel::{Channel, ChannelConfig, ChannelUrl, NamedChannelOrUrl, ParseChannelError};
pub use channel_data::{ChannelData, ChannelDataPackage};
pub use environment_yaml::{EnvironmentYaml, MatchSpecOrSubSection};
Expand Down
6 changes: 6 additions & 0 deletions crates/rattler_conda_types/src/match_spec/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ impl PartialEq for StringMatcher {
}
}

impl From<String> for StringMatcher {
prsabahrami marked this conversation as resolved.
Show resolved Hide resolved
fn from(s: String) -> Self {
StringMatcher::Exact(s)
}
}

impl StringMatcher {
/// Match string against [`StringMatcher`].
pub fn matches(&self, other: &str) -> bool {
Expand Down
21 changes: 21 additions & 0 deletions crates/rattler_conda_types/src/match_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ pub struct MatchSpec {
pub build_number: Option<BuildNumberSpec>,
/// Match the specific filename of the package
pub file_name: Option<String>,
/// The selected optional features of the package
pub optional_features: Option<Vec<String>>,
/// The channel of the package
pub channel: Option<Arc<Channel>>,
/// The subdir of the channel
Expand Down Expand Up @@ -170,6 +172,20 @@ impl Display for MatchSpec {
None => write!(f, "*")?,
}

match &self.optional_features {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few lines below there are more elements that are added in between brackets.

Please also add one or more tests that shows that this kind of roundtrip parsing is correct.

Some(dependencies) => {
write!(f, "[")?;
for (i, dep) in dependencies.iter().enumerate() {
if i > 0 {
write!(f, ", ")?;
}
write!(f, "{dep}")?;
}
prsabahrami marked this conversation as resolved.
Show resolved Hide resolved
write!(f, "]")?;
}
None => {}
}

if let Some(version) = &self.version {
write!(f, " {version}")?;
}
Expand Down Expand Up @@ -218,6 +234,7 @@ impl MatchSpec {
build: self.build,
build_number: self.build_number,
file_name: self.file_name,
optional_features: self.optional_features,
channel: self.channel,
subdir: self.subdir,
namespace: self.namespace,
Expand Down Expand Up @@ -255,6 +272,8 @@ pub struct NamelessMatchSpec {
pub build_number: Option<BuildNumberSpec>,
/// Match the specific filename of the package
pub file_name: Option<String>,
/// The selected optional features of the package
prsabahrami marked this conversation as resolved.
Show resolved Hide resolved
pub optional_features: Option<Vec<String>>,
/// The channel of the package
#[serde(deserialize_with = "deserialize_channel", default)]
pub channel: Option<Arc<Channel>>,
Expand Down Expand Up @@ -308,6 +327,7 @@ impl From<MatchSpec> for NamelessMatchSpec {
build: spec.build,
build_number: spec.build_number,
file_name: spec.file_name,
optional_features: spec.optional_features,
channel: spec.channel,
subdir: spec.subdir,
namespace: spec.namespace,
Expand All @@ -327,6 +347,7 @@ impl MatchSpec {
build: spec.build,
build_number: spec.build_number,
file_name: spec.file_name,
optional_features: spec.optional_features,
channel: spec.channel,
subdir: spec.subdir,
namespace: spec.namespace,
Expand Down
28 changes: 26 additions & 2 deletions crates/rattler_conda_types/src/match_spec/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use nom::{
branch::alt,
bytes::complete::{tag, take_till1, take_until, take_while, take_while1},
character::complete::{char, multispace0, one_of, space0},
combinator::{opt, recognize},
combinator::{map, opt, recognize},
error::{context, ContextError, ParseError},
multi::{separated_list0, separated_list1},
sequence::{delimited, preceded, separated_pair, terminated},
Expand Down Expand Up @@ -178,6 +178,7 @@ fn parse_bracket_list(input: &str) -> Result<BracketVec<'_>, ParseMatchSpecError
alt((
delimited(char('"'), take_until("\""), char('"')),
delimited(char('\''), take_until("'"), char('\'')),
delimited(char('['), take_until("]"), char(']')),
take_till1(|c| c == ',' || c == ']' || c == '\'' || c == '"'),
)),
))(input)
Expand Down Expand Up @@ -207,7 +208,9 @@ fn parse_bracket_list(input: &str) -> Result<BracketVec<'_>, ParseMatchSpecError
/// Strips the brackets part of the matchspec returning the rest of the
/// matchspec and the contents of the brackets as a `Vec<&str>`.
fn strip_brackets(input: &str) -> Result<(Cow<'_, str>, BracketVec<'_>), ParseMatchSpecError> {
if let Some(matches) = lazy_regex::regex!(r#".*(?:(\[.*\]))$"#).captures(input) {
if let Some(matches) =
lazy_regex::regex!(r#".*(\[(?:[^\[\]]|\[(?:[^\[\]]|\[.*\])*\])*\])$"#).captures(input)
{
let bracket_str = matches.get(1).unwrap().as_str();
let bracket_contents = parse_bracket_list(bracket_str)?;

Expand All @@ -223,6 +226,23 @@ fn strip_brackets(input: &str) -> Result<(Cow<'_, str>, BracketVec<'_>), ParseMa
}
}

/// Parses a list of optional dependencies from a string `[feat1, feat2, feat3]`.
pub fn parse_optional_features(input: &str) -> Result<Vec<String>, ParseMatchSpecError> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test that verifies that the running this function on a few examples results in the expected behavior.

fn parse_features(input: &str) -> IResult<&str, Vec<String>> {
separated_list0(
char(','),
map(take_till1(|c| c == ',' || c == ']'), |s: &str| {
s.trim().to_string()
}),
)(input)
}

match parse_features(input).finish() {
Ok((_remaining, dependencies)) => Ok(dependencies),
Err(_) => Err(ParseMatchSpecError::InvalidBracket),
}
}

/// Parses a [`BracketVec`] into precise components
fn parse_bracket_vec_into_components(
bracket: BracketVec<'_>,
Expand All @@ -248,6 +268,9 @@ fn parse_bracket_vec_into_components(
"version" => match_spec.version = Some(VersionSpec::from_str(value, strictness)?),
"build" => match_spec.build = Some(StringMatcher::from_str(value)?),
"build_number" => match_spec.build_number = Some(BuildNumberSpec::from_str(value)?),
"optional_features" => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I see it in use, should we rename this to features instead? Or optional_dependencies? @wolfv

match_spec.optional_features = Some(parse_optional_features(value)?);
}
"sha256" => {
match_spec.sha256 = Some(
parse_digest_from_hex::<Sha256>(value)
Expand Down Expand Up @@ -1342,6 +1365,7 @@ mod tests {
build: "py27_0*".parse().ok(),
build_number: Some(BuildNumberSpec::from_str(">=6").unwrap()),
file_name: Some("foo-1.0-py27_0.tar.bz2".to_string()),
optional_features: None,
channel: Some(
Channel::from_str("conda-forge", &channel_config())
.map(Arc::new)
Expand Down
9 changes: 8 additions & 1 deletion crates/rattler_conda_types/src/repo_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub mod sharded;
mod topological_sort;

use std::{
collections::BTreeSet,
collections::{BTreeMap, BTreeSet},
fmt::{Display, Formatter},
path::Path,
};
Expand Down Expand Up @@ -146,6 +146,11 @@ pub struct PackageRecord {
#[serde(skip_serializing_if = "NoArchType::is_none")]
pub noarch: NoArchType,

/// Specifications of optional or dependencies. These are dependencies that are
/// only required if certain features are enabled or if certain conditions are met.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub optional_depends: BTreeMap<String, Vec<String>>,
prsabahrami marked this conversation as resolved.
Show resolved Hide resolved
baszalmstra marked this conversation as resolved.
Show resolved Hide resolved
prsabahrami marked this conversation as resolved.
Show resolved Hide resolved

/// Optionally the platform the package supports
pub platform: Option<String>, // Note that this does not match the [`Platform`] enum..

Expand Down Expand Up @@ -323,6 +328,7 @@ impl PackageRecord {
noarch: NoArchType::default(),
platform: None,
python_site_packages_path: None,
optional_depends: BTreeMap::new(),
sha256: None,
size: None,
subdir: Platform::current().to_string(),
Expand Down Expand Up @@ -511,6 +517,7 @@ impl PackageRecord {
noarch: index.noarch,
platform: index.platform,
python_site_packages_path: index.python_site_packages_path,
optional_depends: BTreeMap::new(),
sha256,
size,
subdir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ depends:
license: Unlicense
md5: 5e5a97795de72f8cc3baf3d9ea6327a2
name: libsqlite
optional_depends: {}
platform: win32
sha256: 4e50b3d90a351c9d47d239d3f90fce4870df2526e4f7fef35203ab3276a6dfc9
size: 669941
Expand Down Expand Up @@ -55,4 +56,3 @@ link:
source: "C:\\Users\\bas\\micromamba\\envs\\conda\\pkgs\\libsqlite-3.40.0-hcfcfb64_0"
type: 1
requested_spec: "conda-forge/win-64::libsqlite==3.40.0=hcfcfb64_0[md5=5e5a97795de72f8cc3baf3d9ea6327a2]"

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/rattler_conda_types/src/prefix_record.rs
assertion_line: 266
expression: prefix_record
---
arch: x86_64
Expand All @@ -12,6 +11,7 @@ depends:
license: BSD-3-Clause
md5: 8eb00075c8acb7dd264c4a8537b89549
name: menuinst
optional_depends: {}
platform: win
sha256: f23b6f89654c21ff994991a2c0e018311e2a9288a68796d1612d4fb953b75be2
size: 110326
Expand Down Expand Up @@ -229,4 +229,3 @@ link:
source: "C:\\Users\\bas\\micromamba\\pkgs\\menuinst-1.4.19-py311h1ea47a8_1"
type: 1
requested_spec: ""

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ license_family: MIT
md5: 85b35999162ec95f9f999bac15279c02
name: pip
noarch: python
optional_depends: {}
sha256: bbffec284bd0e154363e845121f43007e7e64c80412ff13be21909be907b697d
size: 1364220
subdir: noarch
Expand Down Expand Up @@ -4552,4 +4553,3 @@ link:
source: "C:\\Users\\bas\\micromamba\\envs\\conda\\pkgs\\pip-23.0-pyhd8ed1ab_0"
type: 1
requested_spec: "conda-forge/noarch::pip==23.0=pyhd8ed1ab_0[md5=85b35999162ec95f9f999bac15279c02]"

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/rattler_conda_types/src/prefix_record.rs
assertion_line: 266
expression: prefix_record
---
build: pyh0701188_6
Expand All @@ -14,6 +13,7 @@ license_family: BSD
md5: 56cd9fe388baac0e90c7149cfac95b60
name: pysocks
noarch: python
optional_depends: {}
prsabahrami marked this conversation as resolved.
Show resolved Hide resolved
sha256: b3a612bc887f3dd0fb7c4199ad8e342bd148cf69a9b74fd9468a18cf2bef07b7
size: 19348
subdir: noarch
Expand Down Expand Up @@ -98,4 +98,3 @@ link:
source: "C:\\Users\\bas\\micromamba\\pkgs\\pysocks-1.7.1-pyh0701188_6"
type: 1
requested_spec: ""

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ license: Apache-2.0
md5: 11d178fc55199482ee48d6812ea83983
name: requests
noarch: python
optional_depends: {}
sha256: 22c081b4cdd023a514400413f50efdf2c378f56f2a5ea9d65666aacf4696490a
size: 56747
subdir: noarch
Expand Down Expand Up @@ -244,4 +245,3 @@ link:
source: "C:\\Users\\bas\\micromamba\\pkgs\\requests-2.28.2-pyhd8ed1ab_0"
type: 1
requested_spec: ""

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: crates/rattler_conda_types/src/prefix_record.rs
assertion_line: 344
expression: prefix_record
---
arch: x86_64
Expand All @@ -13,6 +12,7 @@ license: TCL
license_family: BSD
md5: c69a5047cc9291ae40afd4a1ad6f0c0f
name: tk
optional_depends: {}
platform: win32
sha256: 087795090a99a1d397ef1ed80b4a01fabfb0122efb141562c168e3c0a76edba6
size: 3681762
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ license_family: MIT
md5: 01f33ad2e0aaf6b5ba4add50dad5ad29
name: urllib3
noarch: python
optional_depends: {}
sha256: f2f09c44e47946ce631dbc9a8a79bb463ac0f4122aaafdbcc51f200a1e420ca6
size: 112541
subdir: noarch
Expand Down Expand Up @@ -421,4 +422,3 @@ link:
source: "C:\\Users\\bas\\micromamba\\pkgs\\urllib3-1.26.14-pyhd8ed1ab_0"
type: 1
requested_spec: ""

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ license: BSD-3-Clause
license_family: BSD
md5: 52d246d8d14b83c516229be5bb03a163
name: vc
optional_depends: {}
platform: win32
sha256: 05d5ae5859e8d097559f5445ffbaeac638c9875e4d2a0c5fd8c4bb1c010d35c1
size: 15650
Expand All @@ -31,4 +32,3 @@ link:
source: "C:\\Users\\bas\\micromamba\\envs\\conda\\pkgs\\vc-14.3-hb6edc58_10"
type: 1
requested_spec: "conda-forge/win-64::vc==14.3=hb6edc58_10[md5=52d246d8d14b83c516229be5bb03a163]"

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ license_family: MIT
md5: c829cfb8cb826acb9de0ac1a2df0a940
name: wheel
noarch: python
optional_depends: {}
sha256: bd4f11ff075ff251ade9f57686f31473e25be46ab282d9603f551401250f9f44
size: 32521
subdir: noarch
Expand Down Expand Up @@ -230,4 +231,3 @@ link:
source: "C:\\Users\\bas\\micromamba\\envs\\conda\\pkgs\\wheel-0.38.4-pyhd8ed1ab_0"
type: 1
requested_spec: "conda-forge/noarch::wheel==0.38.4=pyhd8ed1ab_0[md5=c829cfb8cb826acb9de0ac1a2df0a940]"

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ depends:
license: LGPL-2.1 and GPL-2.0
md5: 515d77642eaa3639413c6b1bc3f94219
name: xz
optional_depends: {}
platform: win
sha256: 54d9778f75a02723784dc63aff4126ff6e6749ba21d11a6d03c1f4775f269fe0
size: 217804
Expand Down Expand Up @@ -157,4 +158,3 @@ link:
source: "C:\\Users\\bas\\micromamba\\pkgs\\xz-5.2.6-h8d14728_0"
type: 1
requested_spec: ""

1 change: 1 addition & 0 deletions crates/rattler_index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub fn package_record_from_index_json<T: Read>(
arch: index.arch,
platform: index.platform,
depends: index.depends,
optional_depends: std::collections::BTreeMap::new(),
constrains: index.constrains,
track_features: index.track_features,
features: index.features,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ impl<'a> From<CondaPackageDataModel<'a>> for CondaPackageData {
build_number: value.build_number,
constrains: value.constrains.into_owned(),
depends: value.depends.into_owned(),
optional_depends: std::collections::BTreeMap::new(),
features: value.features.into_owned(),
legacy_bz2_md5: value.legacy_bz2_md5,
legacy_bz2_size: value.legacy_bz2_size.into_owned(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ impl<'a> TryFrom<CondaPackageDataModel<'a>> for CondaPackageData {
build_number,
constrains: value.constrains.into_owned(),
depends: value.depends.into_owned(),
optional_depends: std::collections::BTreeMap::new(),
prsabahrami marked this conversation as resolved.
Show resolved Hide resolved
features: value.features.into_owned(),
legacy_bz2_md5: value.legacy_bz2_md5,
legacy_bz2_size: value.legacy_bz2_size.into_owned(),
Expand Down
1 change: 1 addition & 0 deletions crates/rattler_lock/src/parse/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ pub fn parse_v3_or_lower(
build_number,
constrains: value.constrains,
depends: value.dependencies,
optional_depends: std::collections::BTreeMap::new(),
features: value.features,
legacy_bz2_md5: None,
legacy_bz2_size: None,
Expand Down
9 changes: 9 additions & 0 deletions crates/rattler_repodata_gateway/src/gateway/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,15 @@ impl RepoDataQuery {
pending_package_specs.insert(dependency_name.clone(), SourceSpecs::Transitive);
}
}

for (_, dependencies) in record.package_record.optional_depends.iter() {
for dependency in dependencies {
let dependency_name = PackageName::new_unchecked(dependency.split_once(' ').unwrap_or((dependency, "")).0);
if seen.insert(dependency_name.clone()) {
pending_package_specs.insert(dependency_name.clone(), SourceSpecs::Transitive);
}
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rattler_solve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub enum ChannelPriority {
/// precedence.
Disabled,
}

#[derive(Debug, Clone, PartialEq, Eq)]
/// Represents a dependency resolution task, to be solved by one of the backends
pub struct SolverTask<TAvailablePackagesIterator> {
/// An iterator over all available packages
Expand Down
Loading
Loading