Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Feb 13, 2021
1 parent a5cc8e7 commit a53fb1f
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ jobs:
with:
profile: minimal
toolchain: stable
target: aarch64-apple-darwin
override: true
- name: Install aarch64-apple-darwin Rust target
if: matrix.os == 'macos-latest'
run: rustup target add aarch64-apple-darwin
#- name: Cache cargo registry
# uses: actions/cache@v2
# with:
Expand Down
56 changes: 54 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ dirs = { version = "3.0.1", optional = true }
configparser = { version = "2.0.0", optional = true }
mailparse = "0.13.1"
fs-err = "2.5.0"
fat-macho = "0.2.0"
fat-macho = "0.4.2"

[dev-dependencies]
indoc = "1.0.2"
Expand Down
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ FLAGS:
--strip
Strip the library for minimum file size
--universal2
Control whether to build universal2 wheel for macOS or not. Only applies to macOS targets, do nothing
otherwise
-V, --version
Prints version information
Expand Down
5 changes: 3 additions & 2 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ pub struct BuildOptions {
/// Use as `--rustc-extra-args="--my-arg"`
#[structopt(long = "rustc-extra-args")]
pub rustc_extra_args: Vec<String>,
/// Control whether to build universal2 wheel for macOS or not
/// Control whether to build universal2 wheel for macOS or not.
/// Only applies to macOS targets, do nothing otherwise.
#[structopt(long)]
pub universal2: bool,
}
Expand All @@ -85,7 +86,7 @@ impl Default for BuildOptions {
target: None,
cargo_extra_args: Vec::new(),
rustc_extra_args: Vec::new(),
universal2: true,
universal2: false,
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use crate::BuildContext;
use crate::PythonInterpreter;
use anyhow::{anyhow, bail, Context, Result};
use fat_macho::FatWriter;
use fs_err::File;
use fs_err::{self as fs, File};
use std::collections::HashMap;
use std::fs;
use std::io::{BufReader, Read};
use std::path::PathBuf;
use std::process::{Command, Stdio};
Expand Down Expand Up @@ -72,10 +71,10 @@ pub fn compile(
let aarch64_file = fs::read(aarch64_artifact)?;
let x86_64_file = fs::read(x86_64_artifact)?;
writer
.add(&aarch64_file)
.add(aarch64_file)
.map_err(|e| anyhow!("Failed to add aarch64 cdylib: {:?}", e))?;
writer
.add(&x86_64_file)
.add(x86_64_file)
.map_err(|e| anyhow!("Failed to add x86_64 cdylib: {:?}", e))?;
writer
.write_to_file(&output_path)
Expand Down
2 changes: 1 addition & 1 deletion src/develop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn develop(
target: None,
cargo_extra_args,
rustc_extra_args,
universal2: true,
universal2: false,
};

let build_context = build_options.into_build_context(release, strip)?;
Expand Down
15 changes: 0 additions & 15 deletions tests/common/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,6 @@ pub fn test_integration(package: impl AsRef<Path>, bindings: Option<String>) ->

let python = target.get_venv_python(&venv_dir);

// Upgrade pip
let output = Command::new(&python)
.args(&["-m", "pip", "install", "-U", "pip"])
.stderr(Stdio::inherit())
.output()
.context(format!("pip install failed with {:?}", python))?;
if !output.status.success() {
bail!(
"pip install -U pip failed: {}\n--- Stdout:\n{}\n--- Stderr:\n{}",
output.status,
str::from_utf8(&output.stdout)?,
str::from_utf8(&output.stderr)?,
);
}

let command = [
"-m",
"pip",
Expand Down

0 comments on commit a53fb1f

Please sign in to comment.