Skip to content

Commit

Permalink
Rename fixup_import_libs to generate_import_libs
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed May 28, 2022
1 parent 4787ad7 commit 2bd2456
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions pyo3-build-config/src/impl_.rs
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pyo3-build-config/src/lib.rs
Expand Up @@ -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.
Expand Down

0 comments on commit 2bd2456

Please sign in to comment.