aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/build_options.rb
diff options
context:
space:
mode:
authorJack Nagel2014-07-30 21:46:22 -0500
committerJack Nagel2014-07-30 21:46:22 -0500
commit21979aa9f69bfc011489ba5413071e8f4eb656d1 (patch)
tree5e70e14081674d95af9435c2a682582beeb4d1f0 /Library/Homebrew/build_options.rb
parent66b034b943c2c4234c71165d244a581bde5b0b91 (diff)
downloadhomebrew-21979aa9f69bfc011489ba5413071e8f4eb656d1.tar.bz2
Remove confusing implicit options handling
This code is supposed to allow depends_on "foo" => "with-bar" to work when foo has only a "without-bar" option. The options system was not designed to support this. Unfortunately, it was bolted on anyway. The implementation is extremely difficult to understand, and it only works for certain types of options, which is confusing from a user's point of view. Luckily, no formulae in core or the official taps rely on the behavior in order to function. It is hindering progress in improving this code, so I am removing it.
Diffstat (limited to 'Library/Homebrew/build_options.rb')
-rw-r--r--Library/Homebrew/build_options.rb29
1 files changed, 0 insertions, 29 deletions
diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb
index 478fd8a84..cbfa790d2 100644
--- a/Library/Homebrew/build_options.rb
+++ b/Library/Homebrew/build_options.rb
@@ -120,33 +120,4 @@ class BuildOptions
def unused_options
Options.new(@options - @args)
end
-
- # Some options are implicitly ON because they are not explictly turned off
- # by their counterpart option. This applies only to with-/without- options.
- # implicit_options are needed because `depends_on 'spam' => 'with-stuff'`
- # complains if 'spam' has stuff as default and only defines `--without-stuff`.
- def implicit_options
- implicit = unused_options.map do |option|
- opposite_of option unless has_opposite_of? option
- end.compact
- Options.new(implicit)
- end
-
- def has_opposite_of? option
- @options.include? opposite_of(option)
- end
-
- def opposite_of option
- option = Option.new(option) unless Option === option
-
- if option.name =~ /^with-(.+)$/
- Option.new("without-#{$1}")
- elsif option.name =~ /^without-(.+)$/
- Option.new("with-#{$1}")
- elsif option.name =~ /^enable-(.+)$/
- Option.new("disable-#{$1}")
- elsif option.name =~ /^disable-(.+)$/
- Option.new("enable-#{$1}")
- end
- end
end