Skip to content

Commit

Permalink
Merge pull request #617 from messense/detect-pypy
Browse files Browse the repository at this point in the history
Autodetect PyPy executables
  • Loading branch information
messense authored Sep 2, 2021
2 parents 5ff228e + 990eda2 commit 58e2381
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* Autodetect PyPy executables in [#617](https://github.com/PyO3/maturin/pull/617)

## [0.11.3] - 2021-08-25

* Add path option for Python source in [#584](https://github.com/PyO3/maturin/pull/584)
Expand Down
12 changes: 10 additions & 2 deletions src/python_interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const GET_INTERPRETER_METADATA: &str = include_str!("get_interpreter_metadata.py
const MINIMUM_PYTHON_MINOR: usize = 6;
/// Be liberal here to include preview versions
const MAXIMUM_PYTHON_MINOR: usize = 12;
const MAXIMUM_PYPY_MINOR: usize = 8;

/// Identifies conditions where we do not want to build wheels
fn windows_interpreter_no_build(
Expand Down Expand Up @@ -497,9 +498,16 @@ impl PythonInterpreter {
let executables = if target.is_windows() {
find_all_windows(target, min_python_minor)?
} else {
(min_python_minor..MAXIMUM_PYTHON_MINOR)
let mut executables: Vec<String> = (min_python_minor..MAXIMUM_PYTHON_MINOR)
.map(|minor| format!("python3.{}", minor))
.collect()
.collect();
// Also try to find PyPy for cffi and pyo3 bindings
if matches!(bridge, BridgeModel::Cffi) || bridge.is_bindings("pyo3") {
executables.extend(
(min_python_minor..MAXIMUM_PYPY_MINOR).map(|minor| format!("pypy3.{}", minor)),
);
}
executables
};
let mut available_versions = Vec::new();
for executable in executables {
Expand Down

0 comments on commit 58e2381

Please sign in to comment.