xref: /aosp_15_r20/external/pigweed/pw_build/py/gn_tests/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2023 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/python.gni")
18import("$dir_pw_build/python_action_test.gni")
19import("$dir_pw_build/python_dist.gni")
20import("$dir_pw_build/python_venv.gni")
21
22pw_python_distribution("test_dist1") {
23  packages = []
24  generate_setup_cfg = {
25    name = "test_dist1"
26    version = "0.0.1"
27    include_default_pyproject_file = true
28    include_extra_files_in_package_data = true
29  }
30  extra_files = [
31    "package_data/empty.csv > test_dist1_data/empty.csv",
32    "package_data/empty.csv > test_dist1_data/subdir/empty.csv",
33  ]
34}
35
36pw_python_action_test("python_package_integration_tests") {
37  action = ":test_dist1._build_wheel($pw_build_PYTHON_TOOLCHAIN)"
38  deps = [
39    ":downstream_project_bundle",
40    ":downstream_project_tools",
41  ]
42  tags = [ "integration" ]
43}
44
45# DOCSTAG: [downstream-project-venv]
46pw_python_distribution("downstream_project_tools") {
47  packages = [
48    "$dir_pw_env_setup/py",
49    "$dir_pw_console/py",
50  ]
51  generate_setup_cfg = {
52    name = "downstream_project_tools"
53    version = "0.0.1"
54    include_default_pyproject_file = true
55  }
56}
57
58pw_python_venv("downstream_tools_build_venv") {
59  path = "$root_build_dir/python-venv-downstream-tools-test"
60  requirements = []
61  constraints =
62      [ "$dir_pw_env_setup/py/pw_env_setup/virtualenv_setup/constraint.list" ]
63  source_packages = [ ":downstream_project_tools" ]
64}
65
66# DOCSTAG: [downstream-project-venv]
67
68pw_python_zip_with_setup("downstream_project_bundle") {
69  packages = [ ":downstream_project_tools" ]
70  venv = ":downstream_tools_build_venv"
71}
72