Fix version satisfier for unpinned dependencies (#74)

This commit is contained in:
Charlie Marsh 2023-10-09 11:48:39 -04:00 committed by GitHub
parent 485b1dceb6
commit 239b5893d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View file

@ -21,6 +21,12 @@ Puffin's limited scope allows us to solve many of the low-level problems that ar
build such a package manager (like package installation) while shipping an immediately useful tool build such a package manager (like package installation) while shipping an immediately useful tool
with a minimal barrier to adoption. Try it today in lieu of `pip` and `pip-tools`. with a minimal barrier to adoption. Try it today in lieu of `pip` and `pip-tools`.
## Features
- Extremely fast dependency resolution and installation: install dependencies in sub-second time.
- Disk-space efficient: Puffin uses a global cache to deduplicate dependencies, and uses
Copy-on-Write on supported filesystems to reduce disk usage.
## Limitations ## Limitations
Puffin does not yet support: Puffin does not yet support:

View file

@ -304,16 +304,14 @@ impl Requirement {
impl Requirement { impl Requirement {
/// Returns `true` if the [`Version`] satisfies the [`Requirement`]. /// Returns `true` if the [`Version`] satisfies the [`Requirement`].
pub fn is_satisfied_by(&self, version: &Version) -> bool { pub fn is_satisfied_by(&self, version: &Version) -> bool {
let Some(specifiers) = let Some(version_or_url) = self.version_or_url.as_ref() else {
self.version_or_url return true;
.as_ref() };
.and_then(|version_or_url| match version_or_url {
VersionOrUrl::VersionSpecifier(specifiers) => Some(specifiers), let specifiers = match version_or_url {
// TODO(charlie): Support URL dependencies. VersionOrUrl::VersionSpecifier(specifiers) => specifiers,
VersionOrUrl::Url(_) => None, // TODO(charlie): Support URL dependencies.
}) VersionOrUrl::Url(_) => return false,
else {
return false;
}; };
specifiers specifiers