Skip to content

Commit

Permalink
Fixed bugs where a dep's specified multiple times with diff extras, a…
Browse files Browse the repository at this point in the history
…nd where win32 is specified as platform
  • Loading branch information
David-OConnor committed Mar 6, 2020
1 parent 7402f14 commit 7664e8b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 29 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,12 @@

## v0.2.5
- Added support for `manylinux2014` spec
- If a dependencies dependencies are specified multiple times, merge `extras`
by ommission. This led to bugs where dependencies didn't get installed when
specified both as an extras and as not
- Dependencies specifying `sys_platform == "win32"` now applies to 64-bit
Windows installations as well. This should fix cases where Windows dependencies
weren't being installed.
- Fixed a dependency-installation bug triggered by symlinks inside Pypi source archives
- `pyflow new` no longer creates a `LICENSE` file

Expand Down
16 changes: 8 additions & 8 deletions README.md
Expand Up @@ -32,22 +32,22 @@ and [Pep 518 (pyproject.toml)](https://www.python.org/dev/peps/pep-0518/).

## Installation
- **Windows** - Download and run
[this installer](https://github.com/David-OConnor/pyflow/releases/download/0.2.4/pyflow-0.2.4-x86_64.msi).
[this installer](https://github.com/David-OConnor/pyflow/releases/download/0.2.5/pyflow-0.2.5-x86_64.msi).
Or, if you have [Scoop](https://scoop.sh) installed, run `scoop install pyflow`.

- **Ubuntu, or another Os that uses Snap** - Run `snap install pyflow --classic`.

- **Ubuntu or Debian without Snap** - Download and run
[this deb](https://github.com/David-OConnor/pyflow/releases/download/0.2.4/pyflow_0.2.4_amd64.deb).
[this deb](https://github.com/David-OConnor/pyflow/releases/download/0.2.5/pyflow_0.2.5_amd64.deb).

- **Fedora, CentOs, RedHat, or older versions of SUSE** - Download and run
[this rpm](https://github.com/David-OConnor/pyflow/releases/download/0.2.4/pyflow-0.2.4.x86_64.rpm).
[this rpm](https://github.com/David-OConnor/pyflow/releases/download/0.2.5/pyflow-0.2.5.x86_64.rpm).

- **A different Linux distro** - Download this
[standalone binary](https://github.com/David-OConnor/pyflow/releases/download/0.2.4/pyflow)
[standalone binary](https://github.com/David-OConnor/pyflow/releases/download/0.2.5/pyflow)
and place it somewhere accessible by the PATH. For example, `/usr/bin`.

- **Mac** - Download this [zipped Mac binary](https://github.com/David-OConnor/pyflow/releases/download/0.2.4/pyflow_mac_0.2.4.zip)
- **Mac** - Download this [zipped Mac binary](https://github.com/David-OConnor/pyflow/releases/download/0.2.5/pyflow_mac_0.2.5.zip)
, ance place the file in it somewhere accessible by the PATH. (Props to @russeldavis for building this)

- **With Pip** - Run `pip install pyflow`. The linux install using this method is much larger than
Expand Down Expand Up @@ -190,7 +190,7 @@ Example contents:
[tool.pyflow]
py_version = "3.7"
name = "runcible"
version = "0.2.4"
version = "0.2.5"
authors = ["John Hackworth <jhackworth@vic.org>"]


Expand Down Expand Up @@ -373,7 +373,7 @@ In order to build and publish your project, additional info is needed in
[tool.pyflow]
name = "everythingkiller"
py_version = "3.6"
version = "0.2.4"
version = "0.2.5"
authors = ["Fraa Erasmas <raz@edhar.math>"]
description = "Small, but packs a punch!"
homepage = "https://everything.math"
Expand All @@ -396,7 +396,7 @@ activate = "jeejah:activate"

[tool.pyflow.dependencies]
numpy = "^1.16.4"
manimlib = "0.2.4"
manimlib = "0.2.5"
ipython = {version = "^7.7.0", extras=["qtconsole"]}


Expand Down
2 changes: 1 addition & 1 deletion snapcraft.yaml
@@ -1,5 +1,5 @@
name: pyflow
version: 0.2.4
version: 0.2.5
license: MIT # todo: This appears to cause the `snapcraft` command to fail.
summary: A Python installation and dependency manager.
description: |
Expand Down
13 changes: 11 additions & 2 deletions src/dep_resolution.rs
Expand Up @@ -278,13 +278,19 @@ fn guess_graph(
for constr in req.constraints.iter() {
c.constraints.push(constr.clone());
}
// If one is specified with an extra and the other without, keep
// the version without the extra. This is probably bad specification, but
// we have to work around it.
if req.extra.is_none() && c.extra.is_some() {
c.extra = None
}
// todo: Should merge sys_platform, python_version, install_with_extras too.
}
}

continue;
}
cleaned_reqs.push(req.clone());
// todo: Should merge extra, sys_platform, python_version, install_with_extras too.
}

let reqs: Vec<&Req> = cleaned_reqs
Expand All @@ -298,7 +304,10 @@ fn guess_graph(
})
.filter(|r| match r.sys_platform {
Some((rt, os_)) => match rt {
ReqType::Exact => os_ == os,
// A specified win32 req could apply to 64-bit windows too.
ReqType::Exact => {
os_ == os || (os_ == util::Os::Windows32 && os == util::Os::Windows)
}
ReqType::Ne => os_ != os,
_ => {
util::abort("Reqtypes for Os must be == or !=");
Expand Down
5 changes: 0 additions & 5 deletions src/files.rs
Expand Up @@ -341,11 +341,6 @@ pub fn parse_req_dot_text(cfg: &mut Config, path: &Path) {
}
}

fn key_re(key: &str) -> Regex {
// todo DRY from main
Regex::new(&format!(r#"^{}\s*=\s*"(.*)"$"#, key)).unwrap()
}

/// Update the config file with a new version.
pub fn change_py_vers(cfg_path: &Path, specified: &Version) {
let f = fs::File::open(&cfg_path)
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Expand Up @@ -977,7 +977,7 @@ fn run_script(
// todo DRY
let pypackages_dir = env_path.join("__pypackages__");
let (vers_path, py_vers) =
util::find_venv_info(&cfg_vers, &pypackages_dir, pyflow_dir, dep_cache_path);
util::find_or_create_venv(&cfg_vers, &pypackages_dir, pyflow_dir, dep_cache_path);

let bin_path = util::find_bin_path(&vers_path);
let lib_path = vers_path.join("lib");
Expand Down Expand Up @@ -1421,7 +1421,7 @@ fn main() {

// Check for environments. Create one if none exist. Set `vers_path`.
let (vers_path, py_vers) =
util::find_venv_info(&cfg_vers, &pypackages_path, &pyflow_path, &dep_cache_path);
util::find_or_create_venv(&cfg_vers, &pypackages_path, &pyflow_path, &dep_cache_path);

let paths = util::Paths {
bin: util::find_bin_path(&vers_path),
Expand Down
2 changes: 2 additions & 0 deletions src/py_versions.rs
Expand Up @@ -369,6 +369,8 @@ pub fn create_venv(
// todo perhaps move alias finding back into create_venv, or make a
// todo create_venv_if_doesnt_exist fn.
// Only search for a system Python if we don't have an internal one.
// todo: Why did we choose to prioritize portable over system? Perhaps do the
// todo other way around.
if py_ver.is_none() {
let aliases = find_py_aliases(cfg_v);
match aliases.len() {
Expand Down
12 changes: 1 addition & 11 deletions src/util.rs
Expand Up @@ -95,16 +95,6 @@ pub fn print_color(message: &str, color: Color) {
);
}

///// Print in a color, then reset formatting.
//pub fn print_color_bold(message: &str, color: Color) {
// println!(
// "{}{}{}",
// Colored::Fg(color),
// message,
// Colored::Fg(Color::Reset)
// );
//}

/// Used when the program should exit from a condition that may arise normally from program use,
/// like incorrect info in config files, problems with dependencies, or internet connection problems.
/// We use `expect`, `panic!` etc for problems that indicate a bug in this program.
Expand Down Expand Up @@ -481,7 +471,7 @@ pub fn unpack_tar_xz(archive_path: &Path, dest: &Path) {
}

/// Find venv info, creating a venv as required.
pub fn find_venv_info(
pub fn find_or_create_venv(
cfg_vers: &Version,
pypackages_dir: &Path,
pyflow_dir: &Path,
Expand Down

0 comments on commit 7664e8b

Please sign in to comment.