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)
|
co.check_lib(*cl)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if ces = @script.check_executables
|
if ces = @script.check_programs
|
||||||
ces.each do |ce|
|
ces.each do |ce|
|
||||||
co.check_executable(*ce)
|
co.check_program(*ce)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue ConfigureOp::ConfigureFailure
|
rescue ConfigureOp::ConfigureFailure
|
||||||
|
@ -182,19 +182,19 @@ module Rscons
|
|||||||
common_config_checks(status, options)
|
common_config_checks(status, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check for an executable.
|
# Check for a executable program.
|
||||||
def check_executable(executable, options = {})
|
def check_program(program, options = {})
|
||||||
$stdout.write("Checking for executable '#{executable}'... ")
|
$stdout.write("Checking for program '#{program}'... ")
|
||||||
found = false
|
found = false
|
||||||
if executable["/"] or executable["\\"]
|
if program["/"] or program["\\"]
|
||||||
if File.file?(executable) and File.executable?(executable)
|
if File.file?(program) and File.executable?(program)
|
||||||
found = true
|
found = true
|
||||||
success_message = executable
|
success_message = program
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
path_entries = ENV["PATH"].split(File::PATH_SEPARATOR)
|
path_entries = ENV["PATH"].split(File::PATH_SEPARATOR)
|
||||||
path_entries.find do |path_entry|
|
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
|
found = true
|
||||||
success_message = path
|
success_message = path
|
||||||
end
|
end
|
||||||
|
@ -66,10 +66,10 @@ module Rscons
|
|||||||
@script.check_libs << args
|
@script.check_libs << args
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check for an executable.
|
# Check for an executable program.
|
||||||
def check_executable(*args)
|
def check_program(*args)
|
||||||
@script.check_executables ||= []
|
@script.check_programs ||= []
|
||||||
@script.check_executables << args
|
@script.check_programs << args
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ module Rscons
|
|||||||
|
|
||||||
# @return [Array<Array>]
|
# @return [Array<Array>]
|
||||||
# Executables to check for.
|
# Executables to check for.
|
||||||
attr_accessor :check_executables
|
attr_accessor :check_programs
|
||||||
|
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
# Whether to autoconfigure if the user does not explicitly perform a
|
# Whether to autoconfigure if the user does not explicitly perform a
|
||||||
|
@ -1725,29 +1725,29 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "check_executable" do
|
context "check_program" do
|
||||||
it "succeeds when the requested executable is found" do
|
it "succeeds when the requested program is found" do
|
||||||
test_dir "configure"
|
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.stderr).to eq ""
|
||||||
expect(result.status).to eq 0
|
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
|
end
|
||||||
|
|
||||||
it "fails when the requested executable is not found" do
|
it "fails when the requested program is not found" do
|
||||||
test_dir "configure"
|
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.stderr).to eq ""
|
||||||
expect(result.status).to_not eq 0
|
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
|
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"
|
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.stderr).to eq ""
|
||||||
expect(result.status).to eq 0
|
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
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user