Rename `fixup_import_libs` to `generate_import_libs`

This commit is contained in:
messense 2022-05-28 15:07:10 +08:00
parent 4787ad75c9
commit 2bd24565c4
No known key found for this signature in database
GPG Key ID: BB41A8A2C716CCA9
2 changed files with 13 additions and 9 deletions

View File

@ -464,20 +464,24 @@ print("mingw", get_platform().startswith("mingw"))
})
}
#[cfg(feature = "python3-dll-a")]
#[allow(clippy::unnecessary_wraps)]
pub fn fixup_import_libs(&mut self) -> Result<()> {
pub fn generate_import_libs(&mut self) -> Result<()> {
// Auto generate python3.dll import libraries for Windows targets.
#[cfg(feature = "python3-dll-a")]
{
if self.lib_dir.is_none() {
let target = target_triple_from_env();
let py_version = if self.abi3 { None } else { Some(self.version) };
self.lib_dir = self::import_lib::generate_import_lib(&target, py_version)?;
}
if self.lib_dir.is_none() {
let target = target_triple_from_env();
let py_version = if self.abi3 { None } else { Some(self.version) };
self.lib_dir = import_lib::generate_import_lib(&target, py_version)?;
}
Ok(())
}
#[cfg(not(feature = "python3-dll-a"))]
#[allow(clippy::unnecessary_wraps)]
pub fn generate_import_libs(&mut self) -> Result<()> {
Ok(())
}
#[doc(hidden)]
/// Serialize the `InterpreterConfig` and print it to the environment for Cargo to pass along
/// to dependent packages during build time.

View File

@ -178,7 +178,7 @@ pub mod pyo3_build_script_impl {
pub fn resolve_interpreter_config() -> Result<InterpreterConfig> {
if !CONFIG_FILE.is_empty() {
let mut interperter_config = InterpreterConfig::from_reader(Cursor::new(CONFIG_FILE))?;
interperter_config.fixup_import_libs()?;
interperter_config.generate_import_libs()?;
Ok(interperter_config)
} else if let Some(interpreter_config) = make_cross_compile_config()? {
// This is a cross compile and need to write the config file.