Skip to content

Commit

Permalink
pyo3-build-config: Change for from_sysconfigdata to set the shared pr…
Browse files Browse the repository at this point in the history
…operty based on PYTHONFRAMEWORK in addition to Py_ENABLE_SHARED in order that a macos Framework build is considered shared just like the logic in from_interpreter
  • Loading branch information
Kevin Phillips committed Mar 17, 2022
1 parent c5517ad commit 13f13e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Considered `PYTHONFRAMEWORK` when cross compiling in order that on macos cross compiling against a [Framework bundle](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html) is considered shared. [#2233](/~https://github.com/PyO3/pyo3/pull/2233)

- Panic during compilation when `PYO3_CROSS_LIB_DIR` is set for some host/target combinations. [#2232](/~https://github.com/PyO3/pyo3/pull/2232)

## [0.16.2] - 2022-03-15
Expand Down
7 changes: 6 additions & 1 deletion pyo3-build-config/src/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ print("mingw", get_platform().startswith("mingw"))
Some("0") | Some("false") | Some("False") => false,
_ => bail!("expected a bool (1/true/True or 0/false/False) for Py_ENABLE_SHARED"),
};
// macOS framework packages use shared linking (PYTHONFRAMEWORK is the framework name, hence the empty check)
let framework = match sysconfigdata.get_value("PYTHONFRAMEWORK") {
Some(s) => !s.is_empty(),
_ => false,
};
let lib_dir = get_key!(sysconfigdata, "LIBDIR").ok().map(str::to_string);
let lib_name = Some(default_lib_name_unix(
version,
Expand All @@ -313,7 +318,7 @@ print("mingw", get_platform().startswith("mingw"))
Ok(InterpreterConfig {
implementation,
version,
shared,
shared: shared || framework,
abi3: is_abi3(),
lib_dir,
lib_name,
Expand Down

0 comments on commit 13f13e5

Please sign in to comment.