Use URL rather than String in direct URL types (#643)

This commit is contained in:
Charlie Marsh 2023-12-13 20:01:27 -05:00 committed by GitHub
parent 8071a23863
commit 4fd69c74b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -2,6 +2,7 @@ use std::collections::HashMap;
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use url::Url;
/// Metadata for a distribution that was installed via a direct URL.
///
@ -13,13 +14,13 @@ pub enum DirectUrl {
/// ```json
/// {"url": "file:///home/user/project", "dir_info": {}}
/// ```
LocalDirectory { url: String, dir_info: DirInfo },
LocalDirectory { url: Url, dir_info: DirInfo },
/// The direct URL is a path to an archive. For example:
/// ```json
/// {"archive_info": {"hash": "sha256=75909db2664838d015e3d9139004ee16711748a52c8f336b52882266540215d8", "hashes": {"sha256": "75909db2664838d015e3d9139004ee16711748a52c8f336b52882266540215d8"}}, "url": "https://files.pythonhosted.org/packages/b8/8b/31273bf66016be6ad22bb7345c37ff350276cfd46e389a0c2ac5da9d9073/wheel-0.41.2-py3-none-any.whl"}
/// ```
ArchiveUrl {
url: String,
url: Url,
archive_info: ArchiveInfo,
#[serde(skip_serializing_if = "Option::is_none")]
subdirectory: Option<PathBuf>,
@ -29,7 +30,7 @@ pub enum DirectUrl {
/// {"url": "https://github.com/pallets/flask.git", "vcs_info": {"commit_id": "8d9519df093864ff90ca446d4af2dc8facd3c542", "vcs": "git"}}
/// ```
VcsUrl {
url: String,
url: Url,
vcs_info: VcsInfo,
#[serde(skip_serializing_if = "Option::is_none")]
subdirectory: Option<PathBuf>,