From e07b02fde2a423ef6389330a80f4c3e5e71fcfed Mon Sep 17 00:00:00 2001 From: Markus Reiter <me@reitermark.us> Date: Thu, 30 Jul 2020 10:10:42 +0200 Subject: [PATCH] Comment `BUILD_FLAGS`. --- Library/Homebrew/formula.rb | 7 ++++--- Library/Homebrew/formulary.rb | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index ff180c4d22..ad385131e4 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2378,12 +2378,13 @@ class Formula stable.build end + # Get the `BUILD_FLAGS` from the formula's namespace set in `Formulary::load_formula`. # @private def build_flags - mod_name = to_s.split("::")[0..-2].join("::") - return [] if mod_name.empty? + namespace = to_s.split("::")[0..-2].join("::") + return [] if namespace.empty? - mod = const_get(mod_name) + mod = const_get(namespace) mod.const_get(:BUILD_FLAGS) end diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index a812e589c9..80600d7e34 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -34,6 +34,8 @@ module Formulary const_set(namespace, mod) begin + # Set `BUILD_FLAGS` in the formula's namespace so we can + # access them from within the formula's class scope. mod.const_set(:BUILD_FLAGS, flags) mod.module_eval(contents, path) rescue NameError, ArgumentError, ScriptError => e -- GitLab