Comment BUILD_FLAGS.

This commit is contained in:
Markus Reiter 2020-07-30 10:10:42 +02:00
parent 08e35e9cb4
commit e07b02fde2
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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