Skip to content

Commit

Permalink
updated so TestSCons.NINJA_BINARY is set and used by all such tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbaddog committed Nov 25, 2024
1 parent 8999666 commit 0b5ab8b
Show file tree
Hide file tree
Showing 24 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion test/ninja/build_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
except ImportError:
test.skip_test("Could not find ninja module. Skipping test.\n")

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/command_line_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/copy_function_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/default_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
3 changes: 1 addition & 2 deletions test/ninja/force_scons_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()

ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture("ninja-fixture")

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/generate_and_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/generate_and_build_cxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/generate_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
3 changes: 1 addition & 2 deletions test/ninja/generated_sources_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()

ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/iterative_speedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/mingw_command_generator_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/mingw_depfile_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/mkdir_function_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.write('SConstruct', """
SetOption('experimental','ninja')
Expand Down
2 changes: 1 addition & 1 deletion test/ninja/multi_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test = TestSCons.TestSCons()

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/ninja_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture', 'src')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/ninja_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/ninja_file_deterministic.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
3 changes: 1 addition & 2 deletions test/ninja/ninja_handle_control_c_rebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@

_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture("ninja-fixture")

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/no_for_sig_subst.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/response_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
_exe = TestSCons._exe
_obj = TestSCons._obj

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/shell_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/shutdown_scons_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = test.ninja_binary()
ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture("ninja-fixture")

Expand Down
3 changes: 3 additions & 0 deletions testing/framework/TestCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@
IS_ROOT = False
NEED_HELPER = os.environ.get('SCONS_NO_DIRECT_SCRIPT')




# sentinel for cases where None won't do
_Null = object()

Expand Down
18 changes: 8 additions & 10 deletions testing/framework/TestSCons.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
'lib_',
'_lib',
'dll_',
'_dll'
'_dll',
'NINJA_BINARY'
])

machine_map = {
Expand Down Expand Up @@ -103,6 +104,12 @@
_dll = dll_suffix
dll_ = dll_prefix

try:
import ninja
NINJA_BINARY = os.path.abspath(os.path.join(ninja.BIN_DIR, 'ninja' + _exe))
except ImportError:
NINJA_BINARY = None

if sys.platform == 'cygwin':
# On Cygwin, os.path.normcase() lies, so just report back the
# fact that the underlying Win32 OS is case-insensitive.
Expand Down Expand Up @@ -1087,15 +1094,6 @@ def java_get_class_files(self, dir):
result.append(os.path.join(dirpath, fname))
return sorted(result)

def ninja_binary(self):
try:
import ninja
except ImportError:
return False

return os.path.abspath(os.path.join(ninja.BIN_DIR, 'ninja' + _exe))


def Qt_dummy_installation(self, dir: str = 'qt') -> None:
# create a dummy qt installation

Expand Down

0 comments on commit 0b5ab8b

Please sign in to comment.