Skip to content

Commit

Permalink
Use native python on linux to build wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
David-OConnor committed May 21, 2020
1 parent df772c1 commit 3f3579f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 49 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## v0.2.6
- Fixed a bug causing source only packages to fail to install
- Added a bug relating to `manylinux2014_i686` wheels
- Fixed a bug relating to `manylinux2014_i686` wheels

## v0.2.5
- Added support for `manylinux2014` spec
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
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.5/pyflow-0.2.5-x86_64.msi).
[this installer](https://github.com/David-OConnor/pyflow/releases/download/0.2.6/pyflow-0.2.6-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.5/pyflow_0.2.5_amd64.deb).
[this deb](https://github.com/David-OConnor/pyflow/releases/download/0.2.6/pyflow_0.2.6_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.5/pyflow-0.2.5.x86_64.rpm).
[this rpm](https://github.com/David-OConnor/pyflow/releases/download/0.2.6/pyflow-0.2.6.x86_64.rpm).

- **A different Linux distro** - Download this
[standalone binary](https://github.com/David-OConnor/pyflow/releases/download/0.2.5/pyflow)
[standalone binary](https://github.com/David-OConnor/pyflow/releases/download/0.2.6/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.6/pyflow_mac_0.2.6.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.5"
version = "0.2.6"
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.5"
version = "0.2.6"
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.5"
manimlib = "0.2.6"
ipython = {version = "^7.7.0", extras=["qtconsole"]}


Expand Down
2 changes: 1 addition & 1 deletion snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pyflow
version: 0.2.5
version: 0.2.6
license: MIT # todo: This appears to cause the `snapcraft` command to fail.
summary: A Python installation and dependency manager.
description: |
Expand Down
66 changes: 27 additions & 39 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,54 +335,42 @@ pub fn download_and_install_package(
// todo moves, only copies. Figure out how to do a normal move,
// todo, to speed this up.

let extracted_parent;
let bin_path;
let python;
let extracted_parent = paths.lib.join(folder_name);

replace_distutils(&extracted_parent.join("setup.py"));

#[cfg(target_os = "windows")]
{
let py_name = "python";
extracted_parent = paths.lib.join(folder_name);
bin_path = &paths.bin;
python = bin_path.join(py_name);
}
Command::new(paths.bin.join("python"))
.current_dir(&extracted_parent)
.args(&["setup.py", "bdist_wheel"])
.output()
.expect(&format!(
"Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}",
&extracted_parent,
paths.bin.join("python")
));

// The Linux and Mac builds appear to be unable to build wheels due to
// missing the ctypes library; revert to system python.
#[cfg(target_os = "linux")]
{
let py_name = "python3";
extracted_parent = match fs::canonicalize(paths.lib.join(folder_name)) {
Ok(path) => path,
Err(error) => panic!("Problem converting path to absolute path: {:?}", error),
};
bin_path = fs::canonicalize(&paths.bin);
python = match bin_path {
Ok(path) => path.join(py_name),
Err(error) => panic!("Problem converting path to absolute path: {:?}", error),
};
}
Command::new("python3")
.current_dir(&extracted_parent)
.args(&["setup.py", "bdist_wheel"])
.output()
.expect(&format!(
"Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}",
&extracted_parent,
paths.bin.join("python")
));
#[cfg(target_os = "macos")]
{
let py_name = "python3";
extracted_parent = match fs::canonicalize(paths.lib.join(folder_name)) {
Ok(path) => path,
Err(error) => panic!("Problem converting path to absolute path: {:?}", error),
};
bin_path = fs::canonicalize(&paths.bin);
python = match bin_path {
Ok(path) => path.join(py_name),
Err(error) => panic!("Problem converting path to absolute path: {:?}", error),
};
}

replace_distutils(&extracted_parent.join("setup.py"));

Command::new(&python)
Command::new("python3")
.current_dir(&extracted_parent)
.args(&["setup.py", "bdist_wheel"])
.output()
// .expect(&format!("Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}", &extracted_parent, paths.bin.join("python")));
.expect(&format!(
"Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}",
&extracted_parent, &python
&extracted_parent,
paths.bin.join("python")
));

let dist_path = &extracted_parent.join("dist");
Expand Down

0 comments on commit 3f3579f

Please sign in to comment.