Skip to content

Commit

Permalink
Fixed extras in brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
David-OConnor committed Dec 3, 2019
1 parent 6bd8d0f commit 59b8f5a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyflow"
version = "0.2.2"
version = "0.2.3"
authors = ["David O'Connor <[email protected]>"]
description = "A modern Python installation and dependency manager"
license = "MIT"
Expand Down Expand Up @@ -32,7 +32,6 @@ toml = "^0.5.1"
zip = "^0.5.2"
# We don't use native TLS, to avoid dependency issues on different linux distros.
reqwest = { version = "^0.9.21", default-features = false, features = ["rustls-tls"] }
#reqwest = "^0.9.21"

# Vendorize OpenSSl on Linux, to avoid compatibility problems.
# todo: target-specific features aren't currently supported.
Expand Down
33 changes: 0 additions & 33 deletions snapcraft.yaml

This file was deleted.

16 changes: 11 additions & 5 deletions src/dep_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,8 @@ impl Constraint {
} else {
max = Version::new(self.version.major + 1, 0, 0);
}
min < *version && *version < max

min <= *version && *version < max
}
}
}
Expand Down Expand Up @@ -784,12 +785,15 @@ impl Req {
Constraint::from_str_multiple(reqs_m.as_str())?
};

let (mut extra, sys_platform, python_version) =
let (extra, sys_platform, python_version) =
parse_extras(caps.get(if pypi_fmt { 4 } else { 3 }));

// Now handle extras in brackets. Assume it's a simple string of the name.
let mut install_with_extras = None;
if extra.is_none() && pypi_fmt {
if let Some(ex) = caps.get(2) {
extra = Some(ex.as_str().to_owned())
// todo: Handle multiple install_with_extras.
install_with_extras = Some(vec![ex.as_str().to_owned()])
}
}

Expand All @@ -799,7 +803,7 @@ impl Req {
extra,
sys_platform,
python_version,
install_with_extras: None,
install_with_extras,
path: None,
git: None,
});
Expand Down Expand Up @@ -1357,12 +1361,14 @@ pub mod tests {

#[test]
fn parse_req_pypi_bracket() {
// Note that [ufo] doesn't refer to an extra required to install this input; it's
// an extra that may trigger additional installs from fonttools.
let actual = Req::from_str("fonttools[ufo] (>=3.34.0)", true).unwrap();
let mut expected = Req::new(
"fonttools".into(),
vec![Constraint::new(Gte, Version::new(3, 34, 0))],
);
expected.extra = Some("ufo".to_string());
expected.install_with_extras = Some(vec!["ufo".to_string()]);

assert_eq!(actual, expected);
}
Expand Down
5 changes: 5 additions & 0 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,15 @@ pub fn download_and_install_package(
&archive_path
));
}

// Extract the tar.gz source code.
let tar = GzDecoder::new(&archive_file);
// println!("TAR: {:?}", &tar);
let mut archive = Archive::new(tar);

// println!("arc p: {:?}", &archive_path);
// println!("arc f: {:?}", &archive_file);

// Perhaps we're dealing with a zip.
if archive.unpack(&paths.lib).is_err() {
println!(
Expand Down

0 comments on commit 59b8f5a

Please sign in to comment.