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 | |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 15 | filegroup { |
| 16 | name: "py3-stdlib-srcs", |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame^] | 17 | visibility: ["//visibility:private"], |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 18 | srcs: [ |
| 19 | "*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 20 | "asyncio/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 21 | "collections/**/*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 22 | "concurrent/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 23 | "ctypes/**/*.py", |
| 24 | "distutils/**/*.py", |
| 25 | "email/**/*.py", |
| 26 | "encodings/**/*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 27 | "html/**/*.py", |
| 28 | "http/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 29 | "importlib/**/*.py", |
| 30 | "json/**/*.py", |
| 31 | "logging/**/*.py", |
| 32 | "multiprocessing/**/*.py", |
| 33 | "pydoc_data/**/*.py", |
| 34 | "sqlite3/**/*.py", |
| 35 | "unittest/**/*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 36 | "urllib/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 37 | "wsgiref/**/*.py", |
| 38 | "xml/**/*.py", |
Dan Willemsen | ee44d9a | 2020-01-20 23:02:18 -0800 | [diff] [blame] | 39 | "xmlrpc/**/*.py", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 40 | ], |
| 41 | exclude_srcs: [ |
| 42 | "__phello__.foo.py", |
| 43 | ], |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 44 | } |
| 45 | |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame^] | 46 | soong_config_module_type { |
| 47 | name: "cpython3_python_stdlib", |
| 48 | module_type: "python_library", |
| 49 | config_namespace: "cpython3", |
| 50 | bool_variables: ["force_build_host"], |
| 51 | properties: ["defaults"], |
| 52 | } |
| 53 | |
| 54 | python_defaults { |
| 55 | name: "py3-stdlib-force-build", |
| 56 | defaults_visibility: ["//visibility:private"], |
| 57 | target: { |
| 58 | linux_glibc: { |
| 59 | exclude_srcs: [":py3-stdlib-prebuilt-srcs"], |
| 60 | srcs: [":py3-stdlib-srcs"], |
| 61 | }, |
| 62 | darwin: { |
| 63 | exclude_srcs: [":py3-stdlib-prebuilt-srcs"], |
| 64 | srcs: [":py3-stdlib-srcs"], |
| 65 | }, |
| 66 | }, |
| 67 | } |
| 68 | |
| 69 | cpython3_python_stdlib { |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 70 | name: "py3-stdlib", |
| 71 | is_internal: true, |
| 72 | pkg_path: "stdlib", |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 73 | host_supported: true, |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame^] | 74 | target: { |
| 75 | android: { |
| 76 | srcs: [":py3-stdlib-srcs"], |
| 77 | }, |
| 78 | linux_bionic: { |
| 79 | srcs: [":py3-stdlib-srcs"], |
| 80 | }, |
| 81 | linux_glibc: { |
| 82 | srcs: [":py3-stdlib-prebuilt-srcs"], |
| 83 | }, |
| 84 | darwin: { |
| 85 | srcs: [":py3-stdlib-prebuilt-srcs"], |
| 86 | }, |
| 87 | }, |
| 88 | soong_config_variables: { |
| 89 | force_build_host: { |
| 90 | defaults: ["py3-stdlib-force-build"], |
| 91 | }, |
| 92 | }, |
Dan Willemsen | b3614d2 | 2019-10-07 16:06:34 -0700 | [diff] [blame] | 93 | } |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 94 | |
| 95 | // Used by prebuilts/build-tools/build-prebuilts.sh to update |
| 96 | // prebuilts/build-tools/common/py3-stdlib |
| 97 | genrule { |
| 98 | name: "py3-stdlib-zip", |
Dan Willemsen | b33c690 | 2020-12-23 16:39:22 -0800 | [diff] [blame^] | 99 | visibility: ["//visibility:private"], |
Dan Willemsen | 6e34514 | 2020-12-16 19:03:07 -0800 | [diff] [blame] | 100 | tools: ["soong_zip"], |
| 101 | cmd: "echo $(in) >$(genDir)/list && " + |
| 102 | "$(location soong_zip) -o $(out) -C external/python/cpython3/Lib -l $(genDir)/list", |
| 103 | srcs: [":py3-stdlib-srcs"], |
| 104 | out: ["py3-stdlib.zip"], |
| 105 | } |