Skip to content

Commit

Permalink
Always use python3 for zap_cluster_list.py (#7589)
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 authored and pull[bot] committed Jul 8, 2021
1 parent eb0a4bb commit 1925312
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

import("${chip_root}/src/lib/core/core.gni")
Expand Down Expand Up @@ -119,10 +120,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 1925312

Please sign in to comment.