diff --git a/crates/distribution-types/src/cached.rs b/crates/distribution-types/src/cached.rs
index 958ad8fa2..1cea68bf0 100644
--- a/crates/distribution-types/src/cached.rs
+++ b/crates/distribution-types/src/cached.rs
@@ -49,7 +49,7 @@ impl Metadata for CachedDirectUrlDist {
}
fn version_or_url(&self) -> VersionOrUrl {
- VersionOrUrl::Url(&self.url)
+ VersionOrUrl::VersionedUrl(self.url.raw(), &self.filename.version)
}
}
diff --git a/crates/distribution-types/src/installed.rs b/crates/distribution-types/src/installed.rs
index 8a2a7cc50..ce10d01b1 100644
--- a/crates/distribution-types/src/installed.rs
+++ b/crates/distribution-types/src/installed.rs
@@ -7,7 +7,6 @@ use url::Url;
use pep440_rs::Version;
use puffin_normalize::PackageName;
-use pypi_types::{DirectUrl, Metadata21};
use crate::{Metadata, VersionOrUrl};
@@ -31,7 +30,8 @@ pub struct InstalledRegistryDist {
pub struct InstalledDirectUrlDist {
pub name: PackageName,
pub version: Version,
- pub url: DirectUrl,
+ pub url: Url,
+ pub editable: bool,
pub path: PathBuf,
}
@@ -51,8 +51,7 @@ impl Metadata for InstalledDirectUrlDist {
}
fn version_or_url(&self) -> VersionOrUrl {
- // TODO(charlie): Convert a `DirectUrl` to `Url`.
- VersionOrUrl::Version(&self.version)
+ VersionOrUrl::VersionedUrl(&self.url, &self.version)
}
}
@@ -94,7 +93,8 @@ impl InstalledDist {
Ok(Some(Self::Url(InstalledDirectUrlDist {
name,
version,
- url: direct_url,
+ editable: matches!(&direct_url, pypi_types::DirectUrl::LocalDirectory { dir_info, .. } if dir_info.editable == Some(true)),
+ url: Url::from(direct_url),
path: path.to_path_buf(),
})))
} else {
@@ -125,31 +125,28 @@ impl InstalledDist {
}
/// Read the `direct_url.json` file from a `.dist-info` directory.
- fn direct_url(path: &Path) -> Result