Skip to content

Commit

Permalink
Merge pull request #883 from messense/fix-882
Browse files Browse the repository at this point in the history
Fix PyPy pep517 build when abi3 feature is enabled
  • Loading branch information
messense authored Apr 25, 2022
2 parents 467c3dd + 31143d7 commit 1caadde
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ jobs:
pypy3 -m pip install --force-reinstall --no-index --find-links test-crates/pyo3-pure/target/wheels pyo3-pure
pypy3 -m pip install pytest
pypy3 -m pytest test-crates/pyo3-pure/test_pyo3_pure.py
cargo run -- pep517 build-wheel -i pypy3 -m test-crates/pyo3-pure/Cargo.toml --cargo-extra-args="-vv"
- uses: actions/setup-python@v2
with:
python-version: "3.10.0"
Expand Down
4 changes: 3 additions & 1 deletion src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ impl BuildContext {
.cloned()
.collect();
let mut built_wheels = Vec::new();
built_wheels.extend(self.build_binding_wheel_abi3(&cpythons, *major, *minor)?);
if !cpythons.is_empty() {
built_wheels.extend(self.build_binding_wheel_abi3(&cpythons, *major, *minor)?);
}
if !pypys.is_empty() {
println!(
"⚠️ Warning: PyPy does not yet support abi3 so the build artifacts will be version-specific. \
Expand Down
15 changes: 14 additions & 1 deletion src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,20 @@ pub fn find_interpreter(
Ok(interpreter)
} else if generate_abi3_import_lib {
println!("🐍 Not using a specific python interpreter (Automatically generating windows import library)");
Ok(Vec::new())
// fake a python interpreter
Ok(vec![PythonInterpreter {
major: *major as usize,
minor: *minor as usize,
abiflags: "".to_string(),
target: target.clone(),
executable: PathBuf::new(),
ext_suffix: ".pyd".to_string(),
interpreter_kind: InterpreterKind::CPython,
abi_tag: None,
libs_dir: PathBuf::new(),
platform: None,
runnable: false,
}])
} else {
bail!("Failed to find a python interpreter");
}
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ fn run() -> Result<()> {
if !no_sdist {
build_context.build_source_distribution()?;
}
build_context.build_wheels()?;
let wheels = build_context.build_wheels()?;
assert!(!wheels.is_empty());
}
#[cfg(feature = "upload")]
Opt::Publish {
Expand Down

0 comments on commit 1caadde

Please sign in to comment.