rename check_executable to check_program
This commit is contained in:
parent
3b586cb476
commit
aba11155a4
@ -1,3 +0,0 @@
|
||||
configure do
|
||||
check_executable "executable-that-is-not-found"
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
configure do
|
||||
check_executable "executable-that-is-not-found", fail: false
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
configure do
|
||||
check_executable "find"
|
||||
end
|
3
build_tests/configure/check_program_failure.rb
Normal file
3
build_tests/configure/check_program_failure.rb
Normal file
@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_program "program-that-is-not-found"
|
||||
end
|
3
build_tests/configure/check_program_no_fail.rb
Normal file
3
build_tests/configure/check_program_no_fail.rb
Normal file
@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_program "program-that-is-not-found", fail: false
|
||||
end
|
3
build_tests/configure/check_program_success.rb
Normal file
3
build_tests/configure/check_program_success.rb
Normal file
@ -0,0 +1,3 @@
|
||||
configure do
|
||||
check_program "find"
|
||||
end
|
@ -120,9 +120,9 @@ module Rscons
|
||||
co.check_lib(*cl)
|
||||
end
|
||||
end
|
||||
if ces = @script.check_executables
|
||||
if ces = @script.check_programs
|
||||
ces.each do |ce|
|
||||
co.check_executable(*ce)
|
||||
co.check_program(*ce)
|
||||
end
|
||||
end
|
||||
rescue ConfigureOp::ConfigureFailure
|
||||
|
@ -182,19 +182,19 @@ module Rscons
|
||||
common_config_checks(status, options)
|
||||
end
|
||||
|
||||
# Check for an executable.
|
||||
def check_executable(executable, options = {})
|
||||
$stdout.write("Checking for executable '#{executable}'... ")
|
||||
# Check for a executable program.
|
||||
def check_program(program, options = {})
|
||||
$stdout.write("Checking for program '#{program}'... ")
|
||||
found = false
|
||||
if executable["/"] or executable["\\"]
|
||||
if File.file?(executable) and File.executable?(executable)
|
||||
if program["/"] or program["\\"]
|
||||
if File.file?(program) and File.executable?(program)
|
||||
found = true
|
||||
success_message = executable
|
||||
success_message = program
|
||||
end
|
||||
else
|
||||
path_entries = ENV["PATH"].split(File::PATH_SEPARATOR)
|
||||
path_entries.find do |path_entry|
|
||||
if path = test_path_for_executable(path_entry, executable)
|
||||
if path = test_path_for_executable(path_entry, program)
|
||||
found = true
|
||||
success_message = path
|
||||
end
|
||||
|
@ -66,10 +66,10 @@ module Rscons
|
||||
@script.check_libs << args
|
||||
end
|
||||
|
||||
# Check for an executable.
|
||||
def check_executable(*args)
|
||||
@script.check_executables ||= []
|
||||
@script.check_executables << args
|
||||
# Check for an executable program.
|
||||
def check_program(*args)
|
||||
@script.check_programs ||= []
|
||||
@script.check_programs << args
|
||||
end
|
||||
end
|
||||
|
||||
@ -107,7 +107,7 @@ module Rscons
|
||||
|
||||
# @return [Array<Array>]
|
||||
# Executables to check for.
|
||||
attr_accessor :check_executables
|
||||
attr_accessor :check_programs
|
||||
|
||||
# @return [Boolean]
|
||||
# Whether to autoconfigure if the user does not explicitly perform a
|
||||
|
@ -1725,29 +1725,29 @@ EOF
|
||||
end
|
||||
end
|
||||
|
||||
context "check_executable" do
|
||||
it "succeeds when the requested executable is found" do
|
||||
context "check_program" do
|
||||
it "succeeds when the requested program is found" do
|
||||
test_dir "configure"
|
||||
result = run_rscons(rsconsfile: "check_executable_success.rb", op: "configure")
|
||||
result = run_rscons(rsconsfile: "check_program_success.rb", op: "configure")
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to match /Checking for executable 'find'... .*find/
|
||||
expect(result.stdout).to match /Checking for program 'find'... .*find/
|
||||
end
|
||||
|
||||
it "fails when the requested executable is not found" do
|
||||
it "fails when the requested program is not found" do
|
||||
test_dir "configure"
|
||||
result = run_rscons(rsconsfile: "check_executable_failure.rb", op: "configure")
|
||||
result = run_rscons(rsconsfile: "check_program_failure.rb", op: "configure")
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to_not eq 0
|
||||
expect(result.stdout).to match /Checking for executable 'executable-that-is-not-found'... not found/
|
||||
expect(result.stdout).to match /Checking for program 'program-that-is-not-found'... not found/
|
||||
end
|
||||
|
||||
it "succeeds when the requested executable is not found but :fail is set to false" do
|
||||
it "succeeds when the requested program is not found but :fail is set to false" do
|
||||
test_dir "configure"
|
||||
result = run_rscons(rsconsfile: "check_executable_no_fail.rb", op: "configure")
|
||||
result = run_rscons(rsconsfile: "check_program_no_fail.rb", op: "configure")
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to match /Checking for executable 'executable-that-is-not-found'... not found/
|
||||
expect(result.stdout).to match /Checking for program 'program-that-is-not-found'... not found/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user