|
| 1 | +From 26d493898bd640ffa04df3ed35e7845ecb3fc7b7 Mon Sep 17 00:00:00 2001 |
| 2 | +Message-ID: <26d493898bd640ffa04df3ed35e7845ecb3fc7b7.1698087175.git.stefan@agner.ch> |
| 3 | +In-Reply-To: <d06671d9031156ce3b29e06d7edb344d8f6ee0d6.1698087175.git.stefan@agner.ch> |
| 4 | +References: <d06671d9031156ce3b29e06d7edb344d8f6ee0d6.1698087175.git.stefan@agner.ch> |
| 5 | +From: Stefan Agner <stefan@agner.ch> |
| 6 | +Date: Mon, 23 Oct 2023 20:36:06 +0200 |
| 7 | +Subject: [PATCH] [python] mark chip cluster library as type checking ready |
| 8 | + |
| 9 | +--- |
| 10 | + src/controller/python/BUILD.gn | 12 ++++++++++++ |
| 11 | + src/controller/python/build-chip-wheel.py | 12 +++++++----- |
| 12 | + src/controller/python/chip/clusters/py.typed | 0 |
| 13 | + 3 files changed, 19 insertions(+), 5 deletions(-) |
| 14 | + create mode 100644 src/controller/python/chip/clusters/py.typed |
| 15 | + |
| 16 | +diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn |
| 17 | +index b01dafbc30..58e6c8c487 100644 |
| 18 | +--- a/src/controller/python/BUILD.gn |
| 19 | ++++ b/src/controller/python/BUILD.gn |
| 20 | +@@ -184,11 +184,18 @@ template("chip_python_wheel_action") { |
| 21 | + _py_scripts = [] |
| 22 | + } |
| 23 | + |
| 24 | ++ if (defined(invoker.py_typed_packages)) { |
| 25 | ++ _py_typed_packages = py_typed_packages |
| 26 | ++ } else { |
| 27 | ++ _py_typed_packages = { } |
| 28 | ++ } |
| 29 | ++ |
| 30 | + _py_manifest = { |
| 31 | + files = _py_manifest_files_rebased |
| 32 | + packages = py_packages |
| 33 | + scripts = _py_scripts |
| 34 | + package_reqs = py_package_reqs |
| 35 | ++ typed_packages = _py_typed_packages |
| 36 | + } |
| 37 | + |
| 38 | + write_file(_py_manifest_file, _py_manifest, "json") |
| 39 | +@@ -379,6 +386,7 @@ chip_python_wheel_action("chip-clusters") { |
| 40 | + "chip/clusters/TestObjects.py", |
| 41 | + "chip/clusters/Types.py", |
| 42 | + "chip/clusters/enum.py", |
| 43 | ++ "chip/clusters/py.typed", |
| 44 | + "chip/tlv/__init__.py", |
| 45 | + "chip/tlv/tlvlist.py", |
| 46 | + ] |
| 47 | +@@ -389,6 +397,10 @@ chip_python_wheel_action("chip-clusters") { |
| 48 | + }, |
| 49 | + ] |
| 50 | + |
| 51 | ++ py_typed_packages = [ |
| 52 | ++ "chip.clusters", |
| 53 | ++ ] |
| 54 | ++ |
| 55 | + inputs = [] |
| 56 | + |
| 57 | + py_packages = [ |
| 58 | +diff --git a/src/controller/python/build-chip-wheel.py b/src/controller/python/build-chip-wheel.py |
| 59 | +index 7b21215bdc..92a0f583ca 100644 |
| 60 | +--- a/src/controller/python/build-chip-wheel.py |
| 61 | ++++ b/src/controller/python/build-chip-wheel.py |
| 62 | +@@ -115,6 +115,12 @@ try: |
| 63 | + # Build the chip package... |
| 64 | + # |
| 65 | + packages = manifest['packages'] |
| 66 | ++ package_data = {} |
| 67 | ++ for package in manifest['typed_packages']: |
| 68 | ++ package_data[package] = [ "py.typed" ] |
| 69 | ++ |
| 70 | ++ if libName: |
| 71 | ++ package_data[packages[0]]: [ libName ] |
| 72 | + |
| 73 | + print("packageName: {}".format(packageName)) |
| 74 | + print("libName: {}".format(libName)) |
| 75 | +@@ -140,11 +146,7 @@ try: |
| 76 | + # By default, look in the tmp directory for packages/modules to be included. |
| 77 | + '': tmpDir, |
| 78 | + }, |
| 79 | +- package_data={ |
| 80 | +- packages[0]: [ |
| 81 | +- libName |
| 82 | +- ] |
| 83 | +- } if libName else {}, |
| 84 | ++ package_data=package_data, |
| 85 | + scripts=[name for name in map( |
| 86 | + lambda script: os.path.join(tmpDir, script.installName), |
| 87 | + installScripts |
| 88 | +diff --git a/src/controller/python/chip/clusters/py.typed b/src/controller/python/chip/clusters/py.typed |
| 89 | +new file mode 100644 |
| 90 | +index 0000000000..e69de29bb2 |
| 91 | +-- |
| 92 | +2.42.0 |
| 93 | + |
0 commit comments