Skip to content

Commit

Permalink
Always use python3 for zap_cluster_list.py
Browse files Browse the repository at this point in the history
Unfortunately python is still python2 on some systems and this becomes
the default python interpreter for exec_script(). If we run
zap_cluster_list.py with python2, it's a parse error due to use of
python 3 only optional typing syntax.

If we instead execute the script via gn_run_binary.py, the shebang line
(#!/usr/bin/env python3) in the script will be respected. This is more
likely to work until python2 is dead everywhere, so do that.

Tested by building as a subproject of a project that uses the default
script_executable in GN on a system with /usr/bin/python as python2.
  • Loading branch information
mspang committed Jun 14, 2021
1 parent 16f62ae commit ff75bb5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ template("chip_data_model") {
_cluster_sources = invoker.cluster_sources
} else if (defined(invoker.zap_file)) {
_zap_path = rebase_path(invoker.zap_file, root_build_dir)
_script_path = rebase_path(_zap_cluster_list_script, root_build_dir)
_script_args = [ "--zap_file=" + _zap_path ]

_cluster_sources = exec_script(_zap_cluster_list_script,
_script_args,
_cluster_sources = exec_script("${build_root}/gn_run_binary.py",
[ _script_path ] + _script_args,
"list lines",
[ invoker.zap_file ])
}
Expand Down

0 comments on commit ff75bb5

Please sign in to comment.