| # Copyright 2020 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/python/python.gni") |
| import("//build/testing/host_test_data.gni") |
| |
| # Make the host python prebuilt available in the out dir so it |
| # can be used in python_host_test without making multiple copies. |
| |
| # A regular copy() doesn't work properly with directories. |
| action("copy_lib") { |
| script = "//build/copy_tree.py" |
| args = [ |
| rebase_path("//prebuilt/third_party/python3/${host_platform}/lib", |
| root_build_dir), |
| rebase_path("${python_out_dir}/lib", root_build_dir), |
| rebase_path("${python_out_dir}/lib.stamp", root_build_dir), |
| |
| # The .pyc files may be produced while this action is running, |
| # so we don't want to try to copy them while the're being written. |
| "--ignore_pattern", |
| "__pycache__", |
| "--ignore_pattern", |
| "*.pyc.*", |
| "--ignore_pattern", |
| "*.pyc", |
| ] |
| inputs = [ |
| # This file should change when the package version changes. |
| "//prebuilt/third_party/python3/${host_platform}/include/python${python_version}/pyconfig.h", |
| ] |
| outputs = [ |
| "${python_out_dir}/lib", |
| "${python_out_dir}/lib.stamp", |
| ] |
| visibility = [ ":*" ] |
| } |
| |
| host_test_data("lib") { |
| sources = [ "${python_out_dir}/lib" ] |
| deps = [ ":copy_lib" ] |
| visibility = [ ":*" ] |
| } |
| |
| host_test_data("exe") { |
| sources = [ python_exe_src ] |
| outputs = [ python_exe_path ] |
| visibility = [ ":*" ] |
| } |
| |
| group("interpreter") { |
| testonly = true |
| deps = [ |
| ":exe", |
| ":lib", |
| ] |
| } |