Skip to content

Commit

Permalink
Merge pull request #1423 from lazka/mingw-support
Browse files Browse the repository at this point in the history
Support building with Mingw Python
  • Loading branch information
davidhewitt committed Feb 12, 2021
2 parents d148c79 + e067b32 commit 3df4f9b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix support for using `r#raw_idents` as argument names in pyfunctions. [#1383](https://github.com/PyO3/pyo3/pull/1383)
- Fix unqualified `Result` usage in `pyobject_native_type_base`. [#1402](https://github.com/PyO3/pyo3/pull/1402)
- Fix build on systems where the default Python encoding is not UTF-8. [#1405](https://github.com/PyO3/pyo3/pull/1405)
- Fix build on mingw / MSYS2. [#1423](https://github.com/PyO3/pyo3/pull/1423)

## [0.13.1] - 2021-01-10
### Added
Expand Down
24 changes: 16 additions & 8 deletions build.rs
Expand Up @@ -598,17 +598,25 @@ fn run_python_script(interpreter: &Path, script: &str) -> Result<String> {

fn get_rustc_link_lib(config: &InterpreterConfig) -> String {
let link_name = if env::var("CARGO_CFG_TARGET_OS").unwrap().as_str() == "windows" {
// Link against python3.lib for the stable ABI on Windows.
// See https://www.python.org/dev/peps/pep-0384/#linkage
//
// This contains only the limited ABI symbols.
if env::var_os("CARGO_FEATURE_ABI3").is_some() {
"pythonXY:python3".to_owned()
} else {
if env::var("CARGO_CFG_TARGET_ENV").unwrap().as_str() == "gnu" {
// https://packages.msys2.org/base/mingw-w64-python
format!(
"pythonXY:python{}{}",
"pythonXY:python{}.{}",
config.version.major, config.version.minor
)
} else {
// Link against python3.lib for the stable ABI on Windows.
// See https://www.python.org/dev/peps/pep-0384/#linkage
//
// This contains only the limited ABI symbols.
if env::var_os("CARGO_FEATURE_ABI3").is_some() {
"pythonXY:python3".to_owned()
} else {
format!(
"pythonXY:python{}{}",
config.version.major, config.version.minor
)
}
}
} else {
match config.version.implementation {
Expand Down

0 comments on commit 3df4f9b

Please sign in to comment.