From 8380c9e613e9ee06bf28ff3897b80f502e4ca6c8 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 10 Sep 2024 20:22:44 -0400 Subject: [PATCH] fix: only strip Release and MinSizeRel builds by default (#898) Fix #875. Signed-off-by: Henry Schreiner --- README.md | 3 ++- src/scikit_build_core/resources/scikit-build.schema.json | 2 +- src/scikit_build_core/settings/skbuild_model.py | 3 ++- src/scikit_build_core/settings/skbuild_read_settings.py | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e369ac92..c62a9f58 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,8 @@ build.verbose = false # The components to install. If empty, all default components are installed. install.components = [] -# Whether to strip the binaries. True for scikit-build-core 0.5+. +# Whether to strip the binaries. True for release builds on scikit-build-core +# 0.5+ (0.5-0.10.5 also incorrectly set this for debug builds). install.strip = true # The path (relative to platlib) for the file to generate. diff --git a/src/scikit_build_core/resources/scikit-build.schema.json b/src/scikit_build_core/resources/scikit-build.schema.json index 6cfaa493..2f77d20f 100644 --- a/src/scikit_build_core/resources/scikit-build.schema.json +++ b/src/scikit_build_core/resources/scikit-build.schema.json @@ -303,7 +303,7 @@ }, "strip": { "type": "boolean", - "description": "Whether to strip the binaries. True for scikit-build-core 0.5+." + "description": "Whether to strip the binaries. True for release builds on scikit-build-core 0.5+ (0.5-0.10.5 also incorrectly set this for debug builds)." } } }, diff --git a/src/scikit_build_core/settings/skbuild_model.py b/src/scikit_build_core/settings/skbuild_model.py index b33e0083..3251dc5e 100644 --- a/src/scikit_build_core/settings/skbuild_model.py +++ b/src/scikit_build_core/settings/skbuild_model.py @@ -264,7 +264,8 @@ class InstallSettings: strip: Optional[bool] = None """ - Whether to strip the binaries. True for scikit-build-core 0.5+. + Whether to strip the binaries. True for release builds on scikit-build-core + 0.5+ (0.5-0.10.5 also incorrectly set this for debug builds). """ diff --git a/src/scikit_build_core/settings/skbuild_read_settings.py b/src/scikit_build_core/settings/skbuild_read_settings.py index 6e3033a0..f3845377 100644 --- a/src/scikit_build_core/settings/skbuild_read_settings.py +++ b/src/scikit_build_core/settings/skbuild_read_settings.py @@ -228,7 +228,10 @@ def __init__( or self.settings.minimum_version >= Version("0.5") ) if self.settings.install.strip is None: - self.settings.install.strip = install_policy + self.settings.install.strip = ( + install_policy + and self.settings.cmake.build_type in {"Release", "MinSizeRel"} + ) # If we noted earlier that auto-cmake was requested, handle it now if (