
New `depends_on :python` Dependency. New `depends_on :python3` Dependency. To avoid having multiple formulae with endings -py2 and -py3, we will handle support for different pythons (2.x vs. 3.x) in the same formula. Further brewed vs. external python will be transparently supported. The formula also gets a new object `python`, which is false if no Python is available or the user has disabled it. Otherwise it is defined and provides several support methods: python.site_packages # the site-packages in the formula's Cellar python.global_site_packages python.binary # the full path to the python binary python.prefix python.version python.version.major python.version.minor python.xy # => e.g. "python2.7" python.incdir # includes of python python.libdir # the python dylib library python.pkg_config_path # used internally by brew python.from_osx? python.framework? python.universal? python.pypy? python.standard_caveats # Text to set PYTHONPATH for python.from_osx? python.if3then3 # => "" for 2.x and to "3" for 3.x. Further, to avoid code duplication, `python` takes an optional block that is run twice if the formula defines depends_on :python AND :python3. python do system python, 'setup.py', "--prefix=#{prefix}" end Read more in the Homebrew wiki.
57 lines
1.6 KiB
Ruby
57 lines
1.6 KiB
Ruby
require 'testing_env'
|
|
require 'build_options'
|
|
|
|
class BuildOptionsTests < Test::Unit::TestCase
|
|
def setup
|
|
args = %w{--with-foo --with-bar --without-qux}
|
|
@build = BuildOptions.new(args)
|
|
@build.add("with-foo")
|
|
@build.add("with-bar")
|
|
@build.add("without-baz")
|
|
@build.add("without-qux")
|
|
end
|
|
|
|
def test_as_flags
|
|
assert_equal %w{--with-foo --with-bar --without-baz --without-qux}.sort,
|
|
@build.as_flags.sort
|
|
end
|
|
|
|
def test_has_option?
|
|
assert @build.has_option?("with-foo")
|
|
assert !@build.has_option?("with-qux")
|
|
end
|
|
|
|
def test_include
|
|
assert @build.include?("with-foo")
|
|
assert !@build.include?("with-qux")
|
|
assert !@build.include?("--with-foo")
|
|
end
|
|
|
|
def test_with_without
|
|
assert @build.with?("foo")
|
|
assert @build.with?("bar")
|
|
assert @build.with?("baz")
|
|
assert @build.without?("qux")
|
|
end
|
|
|
|
def test_used_options
|
|
assert @build.used_options.include?("--with-foo")
|
|
assert @build.used_options.include?("--with-bar")
|
|
end
|
|
|
|
def test_unused_options
|
|
assert @build.unused_options.include?("--without-baz")
|
|
end
|
|
|
|
def test_implicit_options
|
|
# --without-baz is not explicitly specified on the command line
|
|
# therefore --with-baz should be implicitly assumed:
|
|
assert @build.implicit_options.include?("--with-baz")
|
|
# But all these should not be in the implict_options:
|
|
assert !@build.implicit_options.include?("--without-baz")
|
|
assert !@build.implicit_options.include?("--with-bar")
|
|
assert !@build.implicit_options.include?("--without-bar")
|
|
assert !@build.implicit_options.include?("--with-qux")
|
|
end
|
|
end
|