From b8b1d2fb0bf3b535acd0c94f6e511ad8dbd93512 Mon Sep 17 00:00:00 2001 From: TBK Date: Wed, 25 Mar 2020 20:23:21 +0100 Subject: testing/gn: new aport --- testing/gn/python3.patch | 220 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 testing/gn/python3.patch (limited to 'testing/gn/python3.patch') diff --git a/testing/gn/python3.patch b/testing/gn/python3.patch new file mode 100644 index 0000000000..78e11f67b8 --- /dev/null +++ b/testing/gn/python3.patch @@ -0,0 +1,220 @@ +--- a/build/full_test.py ++++ b/build/full_test.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2018 The Chromium Authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +--- a/build/gen.py ++++ b/build/gen.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2014 The Chromium Authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +--- a/infra/recipes.py ++++ b/infra/recipes.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + # Copyright 2017 The LUCI Authors. All rights reserved. + # Use of this source code is governed under the Apache License, Version 2.0 +--- a/src/gn/exec_process_unittest.cc ++++ b/src/gn/exec_process_unittest.cc +@@ -33,7 +33,7 @@ + args.push_back(L"-c"); + args.push_back(base::UTF8ToUTF16(command)); + #else +- args.push_back("python"); ++ args.push_back("python3"); + args.push_back("-c"); + args.push_back(command); + #endif +--- a/src/gn/setup.cc ++++ b/src/gn/setup.cc +@@ -717,7 +717,7 @@ + } + build_settings_.set_python_path(python_path.NormalizePathSeparatorsTo('/')); + #else +- build_settings_.set_python_path(base::FilePath("python")); ++ build_settings_.set_python_path(base::FilePath("python3")); + #endif + } + return true; +--- a/src/gn/json_project_writer_unittest.cc ++++ b/src/gn/json_project_writer_unittest.cc +@@ -37,7 +37,7 @@ + SubstitutionList::MakeForTest("//out/Debug/output1.out"); + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + std::vector targets; + targets.push_back(&target); + #if defined(OS_WIN) +@@ -172,7 +172,7 @@ + SubstitutionList::MakeForTest("//out/Debug/{{source_name_part}}.out"); + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + std::vector targets; + targets.push_back(&target); + #if defined(OS_WIN) +--- a/src/gn/ninja_action_target_writer_unittest.cc ++++ b/src/gn/ninja_action_target_writer_unittest.cc +@@ -54,14 +54,14 @@ + ASSERT_TRUE(target.OnResolved(&err)); + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + + std::ostringstream out; + NinjaActionTargetWriter writer(&target, out); + writer.Run(); + + const char* expected = R"(rule __foo_bar___rule +- command = /usr/bin/python ../../foo/script.py ++ command = /usr/bin/python3 ../../foo/script.py + description = ACTION //foo:bar() + restat = 1 + +@@ -96,7 +96,7 @@ + ASSERT_TRUE(target.OnResolved(&err)); + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + + std::ostringstream out; + NinjaActionTargetWriter writer(&target, out); +@@ -105,7 +105,7 @@ + // The console pool's name must be mapped exactly to the string "console" + // which is a special pre-defined pool name in ninja. + const char* expected = R"(rule __foo_bar___rule +- command = /usr/bin/python ../../foo/script.py ++ command = /usr/bin/python3 ../../foo/script.py + description = ACTION //foo:bar() + restat = 1 + +@@ -138,7 +138,7 @@ + ASSERT_TRUE(target.OnResolved(&err)); + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + + std::ostringstream out; + NinjaActionTargetWriter writer(&target, out); +@@ -146,7 +146,7 @@ + + const char expected_linux[] = + "rule __foo_bar___rule\n" +- " command = /usr/bin/python ../../foo/script.py\n" ++ " command = /usr/bin/python3 ../../foo/script.py\n" + " description = ACTION //foo:bar()\n" + " restat = 1\n" + "\n" +@@ -198,7 +198,7 @@ + ASSERT_TRUE(target.OnResolved(&err)); + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + + std::ostringstream out; + NinjaActionTargetWriter writer(&target, out); +@@ -206,7 +206,7 @@ + + const char expected_linux[] = + "rule __foo_bar___rule\n" +- " command = /usr/bin/python ../../foo/script.py -i ${in} " ++ " command = /usr/bin/python3 ../../foo/script.py -i ${in} " + // Escaping is different between Windows and Posix. + #if defined(OS_WIN) + "\"--out=foo$ bar${source_name_part}.o\"\n" +@@ -263,7 +263,7 @@ + target.config_values().inputs().push_back(SourceFile("//foo/included.txt")); + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + + std::ostringstream out; + NinjaActionTargetWriter writer(&target, out); +@@ -271,7 +271,7 @@ + + const char expected_linux[] = + "rule __foo_bar___rule\n" +- " command = /usr/bin/python ../../foo/script.py -i ${in} " ++ " command = /usr/bin/python3 ../../foo/script.py -i ${in} " + #if defined(OS_WIN) + "\"--out=foo$ bar${source_name_part}.o\"\n" + #else +@@ -318,7 +318,7 @@ + SubstitutionList::MakeForTest("//out/Debug/{{source_name_part}}.out"); + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + + std::ostringstream out; + NinjaActionTargetWriter writer(&target, out); +@@ -331,7 +331,7 @@ + // These come from rsp_file_contents above. + " rspfile_content = -j ${source_name_part}\n" + // These come from the args. +- " command = /usr/bin/python ../../foo/script.py ${in} " ++ " command = /usr/bin/python3 ../../foo/script.py ${in} " + "${source_file_part} ${rspfile}\n" + " description = ACTION //foo:bar()\n" + " restat = 1\n" +@@ -376,7 +376,7 @@ + SubstitutionList::MakeForTest("//out/Debug/{{source_name_part}}.out"); + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + + std::ostringstream out; + NinjaActionTargetWriter writer(&target, out); +@@ -385,7 +385,7 @@ + const char expected_linux[] = + "rule __foo_bar___rule\n" + // These come from the args. +- " command = /usr/bin/python ../../foo/script.py ${in} " ++ " command = /usr/bin/python3 ../../foo/script.py ${in} " + "${source_file_part}\n" + " description = ACTION //foo:bar()\n" + " restat = 1\n" +@@ -405,7 +405,7 @@ + TestWithScope setup; + + setup.build_settings()->set_python_path( +- base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++ base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); + + Target dep(setup.settings(), Label(SourceDir("//foo/"), "dep")); + dep.set_output_type(Target::ACTION); +@@ -432,7 +432,7 @@ + const char expected_linux[] = + "rule __foo_foo___rule\n" + // These come from the args. +- " command = /usr/bin/python ../../foo/script.py\n" ++ " command = /usr/bin/python3 ../../foo/script.py\n" + " description = ACTION //foo:foo()\n" + " restat = 1\n" + "\n" +@@ -461,7 +461,7 @@ + const char expected_linux[] = + "rule __bar_bar___rule\n" + // These come from the args. +- " command = /usr/bin/python ../../bar/script.py\n" ++ " command = /usr/bin/python3 ../../bar/script.py\n" + " description = ACTION //bar:bar()\n" + " restat = 1\n" + "\n" -- cgit v1.2.3