Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 dep, err, | 164 dep, err, |
| 165 scope->settings()->build_settings()->root_path_utf8()))); | 165 scope->settings()->build_settings()->root_path_utf8()))); |
| 166 if (err->has_error()) | 166 if (err->has_error()) |
| 167 return Value(); | 167 return Value(); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Make the command line. | 171 // Make the command line. |
| 172 const base::FilePath& python_path = build_settings->python_path(); | 172 const base::FilePath& python_path = build_settings->python_path(); |
| 173 base::CommandLine cmdline(python_path); | 173 base::CommandLine cmdline(python_path); |
| 174 | |
| 175 // Opt out of CommandLine's parameter processing, which reformats switches | |
| 176 // and so on. For GN, arguments should be passed on exactly like they are | |
| 177 // in the .gn file. | |
| 178 cmdline.AppendArg("--"); | |
|
brettw
2016/02/22 22:32:45
I'm confused, won't this pass "--" to Python as we
Nico
2016/02/22 22:58:05
base/command_kind.cc filters out the first -- para
brettw
2016/02/22 23:00:35
Weird, base::CommandLine is a disaster. Can you me
| |
| 179 | |
| 174 cmdline.AppendArgPath(script_path); | 180 cmdline.AppendArgPath(script_path); |
| 175 | 181 |
| 182 | |
|
brettw
2016/02/22 22:32:45
Looks like you got an extra line in here.
Nico
2016/02/22 22:58:05
Will remove
| |
| 176 if (args.size() >= 2) { | 183 if (args.size() >= 2) { |
| 177 // Optional command-line arguments to the script. | 184 // Optional command-line arguments to the script. |
| 178 const Value& script_args = args[1]; | 185 const Value& script_args = args[1]; |
| 179 if (!script_args.VerifyTypeIs(Value::LIST, err)) | 186 if (!script_args.VerifyTypeIs(Value::LIST, err)) |
| 180 return Value(); | 187 return Value(); |
| 181 for (const auto& arg : script_args.list_value()) { | 188 for (const auto& arg : script_args.list_value()) { |
| 182 if (!arg.VerifyTypeIs(Value::STRING, err)) | 189 if (!arg.VerifyTypeIs(Value::STRING, err)) |
| 183 return Value(); | 190 return Value(); |
| 184 cmdline.AppendArg(arg.string_value()); | 191 cmdline.AppendArg(arg.string_value()); |
| 185 } | 192 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 msg); | 249 msg); |
| 243 return Value(); | 250 return Value(); |
| 244 } | 251 } |
| 245 | 252 |
| 246 // Default to None value for the input conversion if unspecified. | 253 // Default to None value for the input conversion if unspecified. |
| 247 return ConvertInputToValue(scope->settings(), output, function, | 254 return ConvertInputToValue(scope->settings(), output, function, |
| 248 args.size() >= 3 ? args[2] : Value(), err); | 255 args.size() >= 3 ? args[2] : Value(), err); |
| 249 } | 256 } |
| 250 | 257 |
| 251 } // namespace functions | 258 } // namespace functions |
| OLD | NEW |