Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 1 | // Copyright 2019 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://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, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Bob Badour | 5f197c6 | 2021-03-08 11:42:11 -0800 | [diff] [blame] | 15 | // *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE |
| 16 | // CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE |
| 17 | // DEPENDING ON IT IN YOUR PROJECT. *** |
| 18 | package { |
| 19 | // See: http://go/android-license-faq |
| 20 | // A large-scale-change added 'default_applicable_licenses' to import |
| 21 | // all of the 'license_kinds' from "external_python_cpython3_license" |
| 22 | // to get the below license kinds: |
| 23 | // SPDX-license-identifier-Apache-2.0 |
| 24 | // SPDX-license-identifier-BSD |
| 25 | // SPDX-license-identifier-GPL |
| 26 | // SPDX-license-identifier-MIT |
| 27 | // SPDX-license-identifier-PSF-2.0 |
| 28 | // SPDX-license-identifier-Unicode-DFS |
| 29 | // SPDX-license-identifier-Zlib |
| 30 | // legacy_by_exception_only (by exception only) |
| 31 | // legacy_notice |
| 32 | // legacy_unencumbered |
| 33 | default_applicable_licenses: ["external_python_cpython3_license"], |
| 34 | } |
| 35 | |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 36 | filegroup { |
| 37 | name: "py3-stdlib-srcs", |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame] | 38 | visibility: ["//visibility:private"], |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 39 | srcs: [ |
| 40 | "*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 41 | "asyncio/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 42 | "collections/**/*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 43 | "concurrent/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 44 | "ctypes/**/*.py", |
| 45 | "distutils/**/*.py", |
| 46 | "email/**/*.py", |
| 47 | "encodings/**/*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 48 | "html/**/*.py", |
| 49 | "http/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 50 | "importlib/**/*.py", |
| 51 | "json/**/*.py", |
| 52 | "logging/**/*.py", |
| 53 | "multiprocessing/**/*.py", |
| 54 | "pydoc_data/**/*.py", |
| 55 | "sqlite3/**/*.py", |
| 56 | "unittest/**/*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 57 | "urllib/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 58 | "wsgiref/**/*.py", |
| 59 | "xml/**/*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 60 | "xmlrpc/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 61 | ], |
| 62 | exclude_srcs: [ |
| 63 | "__phello__.foo.py", |
| 64 | ], |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 65 | } |
| 66 | |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame] | 67 | soong_config_module_type { |
| 68 | name: "cpython3_python_stdlib", |
| 69 | module_type: "python_library", |
| 70 | config_namespace: "cpython3", |
| 71 | bool_variables: ["force_build_host"], |
| 72 | properties: ["defaults"], |
| 73 | } |
| 74 | |
| 75 | python_defaults { |
| 76 | name: "py3-stdlib-force-build", |
| 77 | defaults_visibility: ["//visibility:private"], |
| 78 | target: { |
Colin Cross | e90cb74 | 2022-03-15 21:53:38 +0000 | [diff] [blame^] | 79 | linux_glibc: { |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame] | 80 | exclude_srcs: [":py3-stdlib-prebuilt-srcs"], |
| 81 | srcs: [":py3-stdlib-srcs"], |
| 82 | }, |
| 83 | darwin: { |
| 84 | exclude_srcs: [":py3-stdlib-prebuilt-srcs"], |
| 85 | srcs: [":py3-stdlib-srcs"], |
| 86 | }, |
| 87 | }, |
| 88 | } |
| 89 | |
| 90 | cpython3_python_stdlib { |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 91 | name: "py3-stdlib", |
| 92 | is_internal: true, |
| 93 | pkg_path: "stdlib", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 94 | host_supported: true, |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame] | 95 | target: { |
Colin Cross | e90cb74 | 2022-03-15 21:53:38 +0000 | [diff] [blame^] | 96 | android: { |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame] | 97 | srcs: [":py3-stdlib-srcs"], |
| 98 | }, |
Colin Cross | e90cb74 | 2022-03-15 21:53:38 +0000 | [diff] [blame^] | 99 | linux_bionic: { |
| 100 | srcs: [":py3-stdlib-srcs"], |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame] | 101 | }, |
Colin Cross | e90cb74 | 2022-03-15 21:53:38 +0000 | [diff] [blame^] | 102 | linux_glibc: { |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame] | 103 | srcs: [":py3-stdlib-prebuilt-srcs"], |
| 104 | }, |
| 105 | darwin: { |
| 106 | srcs: [":py3-stdlib-prebuilt-srcs"], |
| 107 | }, |
| 108 | }, |
| 109 | soong_config_variables: { |
| 110 | force_build_host: { |
| 111 | defaults: ["py3-stdlib-force-build"], |
| 112 | }, |
| 113 | }, |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 114 | } |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 115 | |
| 116 | // Used by prebuilts/build-tools/build-prebuilts.sh to update |
| 117 | // prebuilts/build-tools/common/py3-stdlib |
| 118 | genrule { |
| 119 | name: "py3-stdlib-zip", |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame] | 120 | visibility: ["//visibility:private"], |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 121 | tools: ["soong_zip"], |
| 122 | cmd: "echo $(in) >$(genDir)/list && " + |
| 123 | "$(location soong_zip) -o $(out) -C external/python/cpython3/Lib -l $(genDir)/list", |
| 124 | srcs: [":py3-stdlib-srcs"], |
| 125 | out: ["py3-stdlib.zip"], |
| 126 | } |