From b7249ee399036c1829809ba5946c87b6e8fdc8ee Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Fri, 21 Feb 2025 10:52:25 -0500 Subject: [PATCH] visp: update postinstall to support API --- Formula/v/visp.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Formula/v/visp.rb b/Formula/v/visp.rb index 53b37fe5d177..c1898edfc6cc 100644 --- a/Formula/v/visp.rb +++ b/Formula/v/visp.rb @@ -154,13 +154,19 @@ def post_install # Replace SDK paths in bottle when pouring on different OS version than bottle OS. # This avoids error like https://github.com/orgs/Homebrew/discussions/5853 # TODO: Consider handling this in brew, e.g. as part of keg cleaner or bottle relocation - if OS.mac? && Tab.for_formula(self).poured_from_bottle && MacOS.version != bottle&.tag&.to_macos_version + if OS.mac? && (tab = Tab.for_formula(self)).poured_from_bottle + bottle_os = bottle&.tag&.to_macos_version + if bottle_os.nil? && (os_version = tab.built_on.fetch("os_version", "")[/\d+(?:\.\d+)*$/]) + bottle_os = MacOSVersion.new(os_version).strip_patch + end + return if bottle_os.nil? || MacOS.version == bottle_os + sdk_path_files = [ lib/"cmake/visp/VISPConfig.cmake", lib/"cmake/visp/VISPModules.cmake", lib/"pkgconfig/visp.pc", ] - bottle_sdk_path = MacOS.sdk_for_formula(self, bottle&.tag&.to_macos_version).path + bottle_sdk_path = MacOS.sdk_for_formula(self, bottle_os).path inreplace sdk_path_files, bottle_sdk_path, MacOS.sdk_for_formula(self).path, audit_result: false end end