From 7cfa157a2e7218335044d1a16ebaff8bffc8dff3 Mon Sep 17 00:00:00 2001 From: messense Date: Mon, 19 Jul 2021 17:07:40 +0800 Subject: [PATCH] Fix `maturin develop` for PyPy on Unix --- Changelog.md | 1 + src/target.rs | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index 6605e0da1..982c40567 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Use UTF-8 encoding when reading `pyproject.toml` by domdfcoding in [#588](https://github.com/PyO3/maturin/pull/588) * Use Cargo's `repository` field as `Source Code` in project URL in [#590](https://github.com/PyO3/maturin/pull/590) * Fold long header fields in Python metadata in [#594](https://github.com/PyO3/maturin/pull/594) +* Fix `maturin develop` for PyPy on Unix in [#596](https://github.com/PyO3/maturin/pull/596) ## [0.11.1] - 2021-07-10 diff --git a/src/target.rs b/src/target.rs index e6f0c4dd4..a6fec6ae4 100644 --- a/src/target.rs +++ b/src/target.rs @@ -1,3 +1,4 @@ +use crate::python_interpreter::InterpreterKind; use crate::{PlatformTag, PythonInterpreter}; use anyhow::{bail, format_err, Context, Result}; use platform_info::*; @@ -316,13 +317,17 @@ impl Target { interpreter: &PythonInterpreter, ) -> PathBuf { if self.is_unix() { - let python_dir = format!("python{}.{}", interpreter.major, interpreter.minor); - - venv_base - .as_ref() - .join("lib") - .join(python_dir) - .join("site-packages") + match interpreter.interpreter_kind { + InterpreterKind::CPython => { + let python_dir = format!("python{}.{}", interpreter.major, interpreter.minor); + venv_base + .as_ref() + .join("lib") + .join(python_dir) + .join("site-packages") + } + InterpreterKind::PyPy => venv_base.as_ref().join("site-packages"), + } } else { venv_base.as_ref().join("Lib").join("site-packages") }