Skip to content

Commit 1daa53e

Browse files
committedJun 21, 2024
[python] mark chip cluster library as type checking ready
1 parent bf7e9fc commit 1daa53e

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed
 

‎build/chip/python_wheel.gni

+7
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,18 @@ template("chip_python_wheel_action") {
5252
_py_scripts = []
5353
}
5454

55+
if (defined(invoker.py_typed_packages)) {
56+
_py_typed_packages = py_typed_packages
57+
} else {
58+
_py_typed_packages = []
59+
}
60+
5561
_py_manifest = {
5662
files = _py_manifest_files_rebased
5763
packages = py_packages
5864
scripts = _py_scripts
5965
package_reqs = py_package_reqs
66+
typed_packages = _py_typed_packages
6067
}
6168

6269
write_file(_py_manifest_file, _py_manifest, "json")

‎src/controller/python/BUILD.gn

+3
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ chip_python_wheel_action("chip-clusters") {
318318
"chip/clusters/TestObjects.py",
319319
"chip/clusters/Types.py",
320320
"chip/clusters/enum.py",
321+
"chip/clusters/py.typed",
321322
"chip/tlv/__init__.py",
322323
"chip/tlv/tlvlist.py",
323324
]
@@ -328,6 +329,8 @@ chip_python_wheel_action("chip-clusters") {
328329
},
329330
]
330331

332+
py_typed_packages = [ "chip.clusters" ]
333+
331334
inputs = []
332335

333336
py_packages = [

‎src/controller/python/build-chip-wheel.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ def has_ext_modules(foo):
115115
# Build the chip package...
116116
#
117117
packages = manifest['packages']
118+
package_data = {}
119+
for package in manifest['typed_packages']:
120+
package_data[package] = ["py.typed"]
121+
122+
if libName:
123+
package_data[packages[0]]: [libName]
118124

119125
print("packageName: {}".format(packageName))
120126
print("libName: {}".format(libName))
@@ -140,11 +146,7 @@ def has_ext_modules(foo):
140146
# By default, look in the tmp directory for packages/modules to be included.
141147
'': tmpDir,
142148
},
143-
package_data={
144-
packages[0]: [
145-
libName
146-
]
147-
} if libName else {},
149+
package_data=package_data,
148150
scripts=[name for name in map(
149151
lambda script: os.path.join(tmpDir, script.installName),
150152
installScripts

‎src/controller/python/chip/clusters/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)