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