Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use python3 instead of python #2241

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if NINJA_PYTHON is empty, because it not found by find_package(Python3 COMPONENTS Interpreter) (and therefore Python3_EXECUTABLE is empty)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea i think it would fail similarly to today, I can make it error in cmake if you'd like?

)
target_link_libraries(${perftest} PRIVATE libninja libninja-re2c)
endforeach()

Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 0 additions & 2 deletions misc/ninja_syntax.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/python

# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion misc/write_fake_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/manifest_parser_perftest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading