pyo3-build-config: switch to `python3_dll_a::ImportLibraryGenerator`

This commit is contained in:
messense 2022-05-10 15:33:08 +08:00
parent 1482b526de
commit 10cb5a1f95
No known key found for this signature in database
GPG Key ID: BB41A8A2C716CCA9
3 changed files with 9 additions and 8 deletions

View File

@ -12,11 +12,11 @@ edition = "2018"
[dependencies]
once_cell = "1"
python3-dll-a = { version = "0.2", optional = true }
python3-dll-a = { version = "0.2.2", optional = true }
target-lexicon = "0.12"
[build-dependencies]
python3-dll-a = { version = "0.2", optional = true }
python3-dll-a = { version = "0.2.2", optional = true }
target-lexicon = "0.12"
[features]

View File

@ -3,8 +3,8 @@
// Optional python3.dll import library generator for Windows
#[cfg(feature = "python3-dll-a")]
#[path = "abi3_import_lib.rs"]
mod abi3_import_lib;
#[path = "import_lib.rs"]
mod import_lib;
use std::{
collections::{HashMap, HashSet},
@ -1410,7 +1410,7 @@ fn default_cross_compile(cross_compile_config: &CrossCompileConfig) -> Result<In
// Auto generate python3.dll import libraries for Windows targets.
#[cfg(feature = "python3-dll-a")]
if abi3 && lib_dir.is_none() {
lib_dir = self::abi3_import_lib::generate_abi3_import_lib(&cross_compile_config.target)?;
lib_dir = self::import_lib::generate_abi3_import_lib(&cross_compile_config.target)?;
}
Ok(InterpreterConfig {
@ -1723,7 +1723,7 @@ pub fn make_interpreter_config() -> Result<InterpreterConfig> {
// Auto generate python3.dll import libraries for Windows targets.
#[cfg(feature = "python3-dll-a")]
{
interpreter_config.lib_dir = self::abi3_import_lib::generate_abi3_import_lib(&host)?;
interpreter_config.lib_dir = self::import_lib::generate_abi3_import_lib(&host)?;
}
Ok(interpreter_config)

View File

@ -3,7 +3,7 @@
use std::env;
use std::path::PathBuf;
use python3_dll_a::generate_implib_for_target;
use python3_dll_a::ImportLibraryGenerator;
use crate::errors::{Context, Result};
@ -36,7 +36,8 @@ pub(super) fn generate_abi3_import_lib(target: &Triple) -> Result<Option<String>
let env = target.environment.to_string();
generate_implib_for_target(&out_lib_dir, &arch, &env)
ImportLibraryGenerator::new(&arch, &env)
.generate(&out_lib_dir)
.context("failed to generate python3.dll import library")?;
let out_lib_dir_string = out_lib_dir