From a3e7e9e1e63781f55630c44fd1a297dd8c6c4876 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 20 Apr 2022 09:48:13 -0700 Subject: [PATCH] Use python3 instead of python This fixes a few stragglers after 6a17e84370064eec6f22cfb1717ab80cf898d82b --- CMakeLists.txt | 6 +++++- configure.py | 2 +- misc/ninja_syntax.py | 2 -- misc/write_fake_manifests.py | 2 +- src/manifest_parser_perftest.cc | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78243b7bac..f1698c84e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,7 +119,7 @@ function(check_platform_supports_browse_mode RESULT) endfunction() -set(NINJA_PYTHON "python" CACHE STRING "Python interpreter to use for the browse tool") +set(NINJA_PYTHON "python3" CACHE STRING "Python interpreter to use for the browse tool") check_platform_supports_browse_mode(platform_supports_ninja_browse) @@ -293,6 +293,10 @@ if(BUILD_TESTING) manifest_parser_perftest ) add_executable(${perftest} src/${perftest}.cc) + set_source_files_properties(src/${perftest}.cc + PROPERTIES + COMPILE_DEFINITIONS NINJA_PYTHON="${NINJA_PYTHON}" + ) target_link_libraries(${perftest} PRIVATE libninja libninja-re2c) endforeach() diff --git a/configure.py b/configure.py index f9e49f9cdf..1109b8a4ca 100755 --- a/configure.py +++ b/configure.py @@ -344,7 +344,7 @@ def search_system_path(file_name: str) -> Optional[str]: # type: ignore # Missi '/wd4267', '/DNOMINMAX', '/D_CRT_SECURE_NO_WARNINGS', '/D_HAS_EXCEPTIONS=0', - '/DNINJA_PYTHON="%s"' % options.with_python] + '/DNINJA_PYTHON=\\"%s\\"' % options.with_python] if platform.msvc_needs_fs(): cflags.append('/FS') ldflags = ['/DEBUG', '/libpath:$builddir'] diff --git a/misc/ninja_syntax.py b/misc/ninja_syntax.py index 2aa8456e9d..e0716e8aa6 100644 --- a/misc/ninja_syntax.py +++ b/misc/ninja_syntax.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/misc/write_fake_manifests.py b/misc/write_fake_manifests.py index 124ba8b6e0..b1697bedff 100755 --- a/misc/write_fake_manifests.py +++ b/misc/write_fake_manifests.py @@ -6,7 +6,7 @@ ones used in the Chromium project. Usage: - python misc/write_fake_manifests.py outdir # Will run for about 5s. + python3 misc/write_fake_manifests.py outdir # Will run for about 5s. The program contains a hardcoded random seed, so it will generate the same output every time it runs. By changing the seed, it's easy to generate many diff --git a/src/manifest_parser_perftest.cc b/src/manifest_parser_perftest.cc index 853d8e0d5d..1b0fd0e0d8 100644 --- a/src/manifest_parser_perftest.cc +++ b/src/manifest_parser_perftest.cc @@ -48,7 +48,7 @@ bool WriteFakeManifests(const string& dir, string* err) { if (mtime != 0) // 0 means that the file doesn't exist yet. return mtime != -1; - string command = "python misc/write_fake_manifests.py " + dir; + string command = NINJA_PYTHON " misc/write_fake_manifests.py " + dir; printf("Creating manifest data..."); fflush(stdout); int exit_code = system(command.c_str()); printf("done.\n");