-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for stree in get_metadata (#199)
refactor a little get_metadata so it's support returning metadata for stree also --------- Co-authored-by: Tim de Jager <[email protected]>
- Loading branch information
Showing
7 changed files
with
399 additions
and
43 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
236 changes: 236 additions & 0 deletions
236
...t__tests__get_only_metadata_for_local_stree_rich_without_calling_available_artifacts.snap
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,236 @@ | ||
--- | ||
source: crates/rattler_installs_packages/src/artifacts/sdist.rs | ||
expression: wheel_metadata.unwrap().1 | ||
--- | ||
WheelCoreMetadata { | ||
name: PackageName { | ||
source: "rich", | ||
normalized: "rich", | ||
}, | ||
version: Version { | ||
epoch: 0, | ||
release: [ | ||
13, | ||
6, | ||
0, | ||
], | ||
pre: None, | ||
post: None, | ||
dev: None, | ||
local: None, | ||
}, | ||
metadata_version: MetadataVersion( | ||
Version { | ||
epoch: 0, | ||
release: [ | ||
2, | ||
1, | ||
], | ||
pre: None, | ||
post: None, | ||
dev: None, | ||
local: None, | ||
}, | ||
), | ||
requires_dist: [ | ||
Requirement { | ||
name: "ipywidgets", | ||
extras: None, | ||
version_or_url: Some( | ||
VersionSpecifier( | ||
VersionSpecifiers( | ||
[ | ||
VersionSpecifier { | ||
operator: GreaterThanEqual, | ||
version: Version { | ||
epoch: 0, | ||
release: [ | ||
7, | ||
5, | ||
1, | ||
], | ||
pre: None, | ||
post: None, | ||
dev: None, | ||
local: None, | ||
}, | ||
}, | ||
VersionSpecifier { | ||
operator: LessThan, | ||
version: Version { | ||
epoch: 0, | ||
release: [ | ||
9, | ||
], | ||
pre: None, | ||
post: None, | ||
dev: None, | ||
local: None, | ||
}, | ||
}, | ||
], | ||
), | ||
), | ||
), | ||
marker: Some( | ||
Expression( | ||
MarkerExpression { | ||
l_value: Extra, | ||
operator: Equal, | ||
r_value: QuotedString( | ||
"jupyter", | ||
), | ||
}, | ||
), | ||
), | ||
}, | ||
Requirement { | ||
name: "markdown-it-py", | ||
extras: None, | ||
version_or_url: Some( | ||
Url( | ||
Url { | ||
scheme: "git+https", | ||
cannot_be_a_base: false, | ||
username: "", | ||
password: None, | ||
host: Some( | ||
Domain( | ||
"github.com", | ||
), | ||
), | ||
port: None, | ||
path: "/executablebooks/markdown-it-py.git", | ||
query: None, | ||
fragment: None, | ||
}, | ||
), | ||
), | ||
marker: None, | ||
}, | ||
Requirement { | ||
name: "pygments", | ||
extras: None, | ||
version_or_url: Some( | ||
VersionSpecifier( | ||
VersionSpecifiers( | ||
[ | ||
VersionSpecifier { | ||
operator: GreaterThanEqual, | ||
version: Version { | ||
epoch: 0, | ||
release: [ | ||
2, | ||
13, | ||
0, | ||
], | ||
pre: None, | ||
post: None, | ||
dev: None, | ||
local: None, | ||
}, | ||
}, | ||
VersionSpecifier { | ||
operator: LessThan, | ||
version: Version { | ||
epoch: 0, | ||
release: [ | ||
3, | ||
0, | ||
0, | ||
], | ||
pre: None, | ||
post: None, | ||
dev: None, | ||
local: None, | ||
}, | ||
}, | ||
], | ||
), | ||
), | ||
), | ||
marker: None, | ||
}, | ||
Requirement { | ||
name: "typing-extensions", | ||
extras: None, | ||
version_or_url: Some( | ||
VersionSpecifier( | ||
VersionSpecifiers( | ||
[ | ||
VersionSpecifier { | ||
operator: GreaterThanEqual, | ||
version: Version { | ||
epoch: 0, | ||
release: [ | ||
4, | ||
0, | ||
0, | ||
], | ||
pre: None, | ||
post: None, | ||
dev: None, | ||
local: None, | ||
}, | ||
}, | ||
VersionSpecifier { | ||
operator: LessThan, | ||
version: Version { | ||
epoch: 0, | ||
release: [ | ||
5, | ||
0, | ||
], | ||
pre: None, | ||
post: None, | ||
dev: None, | ||
local: None, | ||
}, | ||
}, | ||
], | ||
), | ||
), | ||
), | ||
marker: Some( | ||
Expression( | ||
MarkerExpression { | ||
l_value: MarkerEnvVersion( | ||
PythonVersion, | ||
), | ||
operator: LessThan, | ||
r_value: QuotedString( | ||
"3.9", | ||
), | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
requires_python: Some( | ||
VersionSpecifiers( | ||
[ | ||
VersionSpecifier { | ||
operator: GreaterThanEqual, | ||
version: Version { | ||
epoch: 0, | ||
release: [ | ||
3, | ||
7, | ||
0, | ||
], | ||
pre: None, | ||
post: None, | ||
dev: None, | ||
local: None, | ||
}, | ||
}, | ||
], | ||
), | ||
), | ||
extras: { | ||
Extra { | ||
source: "jupyter", | ||
normalized: "jupyter", | ||
}, | ||
}, | ||
} |
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
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
35 changes: 35 additions & 0 deletions
35
crates/rattler_installs_packages/src/index/direct_url/mod.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 |
---|---|---|
@@ -1,3 +1,38 @@ | ||
use crate::index::http::Http; | ||
use crate::index::package_database::DirectUrlArtifactResponse; | ||
use crate::types::NormalizedPackageName; | ||
use crate::wheel_builder::WheelBuilder; | ||
use url::Url; | ||
|
||
pub(crate) mod file; | ||
pub(crate) mod git; | ||
pub(crate) mod http; | ||
|
||
/// Get artifact directly from file, vcs, or url | ||
pub(crate) async fn fetch_artifact_and_metadata_by_direct_url<P: Into<NormalizedPackageName>>( | ||
http: &Http, | ||
p: P, | ||
url: Url, | ||
wheel_builder: &WheelBuilder, | ||
) -> miette::Result<DirectUrlArtifactResponse> { | ||
let p = p.into(); | ||
|
||
let response = if url.scheme() == "file" { | ||
// This can result in a Wheel, Sdist or STree | ||
super::direct_url::file::get_artifacts_and_metadata(p.clone(), url, wheel_builder).await | ||
} else if url.scheme() == "https" { | ||
// This can be a Wheel or SDist artifact | ||
super::direct_url::http::get_artifacts_and_metadata(http, p.clone(), url, wheel_builder) | ||
.await | ||
} else if url.scheme() == "git+https" || url.scheme() == "git+file" { | ||
// This can be a STree artifact | ||
super::direct_url::git::get_artifacts_and_metadata(p.clone(), url, wheel_builder).await | ||
} else { | ||
Err(miette::miette!( | ||
"Usage of insecure protocol or unsupported scheme {:?}", | ||
url.scheme() | ||
)) | ||
}?; | ||
|
||
Ok(response) | ||
} |
Oops, something went wrong.