winrt-runtime 3.2.1__tar.gz → 4.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. winrt_runtime-4.0.1/LICENSE +22 -0
  2. winrt_runtime-4.0.1/MANIFEST.in +2 -0
  3. winrt_runtime-4.0.1/PKG-INFO +41 -0
  4. winrt_runtime-4.0.1/README.md +16 -0
  5. winrt_runtime-4.0.1/pyproject.toml +62 -0
  6. winrt_runtime-4.0.1/python/winrt/__pyinstaller/__init__.py +13 -0
  7. winrt_runtime-4.0.1/python/winrt/__pyinstaller/hook-winrt.py +85 -0
  8. winrt_runtime-4.0.1/python/winrt/_winrt.pyi +169 -0
  9. {winrt_runtime-3.2.1/src → winrt_runtime-4.0.1/python}/winrt/runtime/__init__.py +7 -0
  10. winrt_runtime-4.0.1/python/winrt/runtime/_internals.py +488 -0
  11. winrt_runtime-4.0.1/python/winrt/runtime/interop.py +25 -0
  12. winrt_runtime-4.0.1/python/winrt/system/__init__.py +191 -0
  13. winrt_runtime-4.0.1/python/winrt/system/hresult.py +47 -0
  14. winrt_runtime-4.0.1/python/winrt_runtime.egg-info/PKG-INFO +41 -0
  15. winrt_runtime-4.0.1/python/winrt_runtime.egg-info/SOURCES.txt +135 -0
  16. winrt_runtime-4.0.1/python/winrt_runtime.egg-info/entry_points.txt +2 -0
  17. winrt_runtime-4.0.1/setup.py +80 -0
  18. winrt_runtime-4.0.1/src/_winrt.cpp +1219 -0
  19. winrt_runtime-4.0.1/src/_winrt_array.cpp +1005 -0
  20. winrt_runtime-4.0.1/src/_winrt_array.h +17 -0
  21. {winrt_runtime-3.2.1 → winrt_runtime-4.0.1/src}/_winrt_box.cpp +91 -164
  22. winrt_runtime-4.0.1/src/_winrt_buffer.cpp +161 -0
  23. winrt_runtime-4.0.1/src/_winrt_buffer.h +15 -0
  24. winrt_runtime-4.0.1/src/arrays.cpp +1562 -0
  25. winrt_runtime-4.0.1/src/arrays.h +109 -0
  26. winrt_runtime-4.0.1/src/async.cpp +252 -0
  27. winrt_runtime-4.0.1/src/async.h +47 -0
  28. winrt_runtime-4.0.1/src/callbacks.cpp +596 -0
  29. winrt_runtime-4.0.1/src/callbacks.h +88 -0
  30. winrt_runtime-4.0.1/src/collections.cpp +413 -0
  31. winrt_runtime-4.0.1/src/collections.h +42 -0
  32. winrt_runtime-4.0.1/src/compose.cpp +1109 -0
  33. winrt_runtime-4.0.1/src/compose.h +37 -0
  34. winrt_runtime-4.0.1/src/delegates.cpp +346 -0
  35. winrt_runtime-4.0.1/src/delegates.h +27 -0
  36. winrt_runtime-4.0.1/src/enums.cpp +166 -0
  37. winrt_runtime-4.0.1/src/enums.h +20 -0
  38. winrt_runtime-4.0.1/src/errors.cpp +546 -0
  39. winrt_runtime-4.0.1/src/generics.cpp +337 -0
  40. winrt_runtime-4.0.1/src/generics.h +31 -0
  41. winrt_runtime-4.0.1/src/implements.cpp +807 -0
  42. winrt_runtime-4.0.1/src/implements.h +107 -0
  43. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/Windows.Foundation.Collections.h +3068 -0
  44. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/Windows.Foundation.Metadata.h +238 -0
  45. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/Windows.Foundation.h +4269 -0
  46. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/Windows.Storage.Streams.h +1475 -0
  47. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/Windows.Storage.h +4771 -0
  48. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/base.h +9770 -0
  49. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/base_macros.h +119 -0
  50. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Devices.Geolocation.0.h +952 -0
  51. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Devices.Geolocation.1.h +250 -0
  52. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Foundation.0.h +958 -0
  53. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Foundation.1.h +248 -0
  54. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Foundation.2.h +230 -0
  55. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Foundation.Collections.0.h +457 -0
  56. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Foundation.Collections.1.h +134 -0
  57. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Foundation.Collections.2.h +62 -0
  58. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Foundation.Metadata.0.h +127 -0
  59. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Foundation.Metadata.1.h +19 -0
  60. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Foundation.Metadata.2.h +26 -0
  61. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.0.h +2058 -0
  62. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.1.h +483 -0
  63. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.2.h +314 -0
  64. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.FileProperties.0.h +460 -0
  65. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.FileProperties.1.h +80 -0
  66. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.FileProperties.2.h +60 -0
  67. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.Provider.0.h +1513 -0
  68. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.Provider.1.h +322 -0
  69. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.Provider.2.h +170 -0
  70. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.Search.0.h +667 -0
  71. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.Search.1.h +142 -0
  72. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.Search.2.h +91 -0
  73. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.Streams.0.h +656 -0
  74. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.Streams.1.h +150 -0
  75. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.Storage.Streams.2.h +108 -0
  76. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.System.0.h +2679 -0
  77. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.System.1.h +573 -0
  78. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.System.2.h +365 -0
  79. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.System.RemoteSystems.0.h +1860 -0
  80. winrt_runtime-4.0.1/src/include/cppwinrt/winrt/impl/Windows.System.RemoteSystems.1.h +488 -0
  81. winrt_runtime-4.0.1/src/include/pythoncapi_compat.h +2600 -0
  82. winrt_runtime-4.0.1/src/include/pywinrt/abi.h +217 -0
  83. winrt_runtime-4.0.1/src/include/pywinrt/array.h +292 -0
  84. winrt_runtime-4.0.1/src/include/pywinrt/async.h +106 -0
  85. winrt_runtime-4.0.1/src/include/pywinrt/base.h +24 -0
  86. winrt_runtime-4.0.1/src/include/pywinrt/buffer.h +81 -0
  87. winrt_runtime-4.0.1/src/include/pywinrt/convert.h +827 -0
  88. winrt_runtime-4.0.1/src/include/pywinrt/errors.h +243 -0
  89. winrt_runtime-4.0.1/src/include/pywinrt/handles.h +239 -0
  90. winrt_runtime-4.0.1/src/include/pywinrt/prelude.h +37 -0
  91. winrt_runtime-4.0.1/src/include/pywinrt/throw_helpers.h +60 -0
  92. winrt_runtime-4.0.1/src/include/pywinrt/traits.h +124 -0
  93. winrt_runtime-4.0.1/src/include/pywinrt/wrappers.h +277 -0
  94. winrt_runtime-4.0.1/src/interp.cpp +1972 -0
  95. winrt_runtime-4.0.1/src/interp.h +498 -0
  96. winrt_runtime-4.0.1/src/members.cpp +716 -0
  97. winrt_runtime-4.0.1/src/members.h +42 -0
  98. winrt_runtime-4.0.1/src/metaclass.h +195 -0
  99. winrt_runtime-4.0.1/src/module_state.h +225 -0
  100. winrt_runtime-4.0.1/src/numerics-buffer.cpp +849 -0
  101. winrt_runtime-4.0.1/src/numerics-buffer.h +33 -0
  102. winrt_runtime-4.0.1/src/numerics-statics.cpp +1106 -0
  103. winrt_runtime-4.0.1/src/numerics-statics.h +22 -0
  104. winrt_runtime-4.0.1/src/numerics-traits.h +89 -0
  105. winrt_runtime-4.0.1/src/numerics-values.h +321 -0
  106. winrt_runtime-4.0.1/src/numerics.cpp +1536 -0
  107. winrt_runtime-4.0.1/src/numerics.h +50 -0
  108. winrt_runtime-4.0.1/src/objects.cpp +1433 -0
  109. winrt_runtime-4.0.1/src/objects.h +64 -0
  110. winrt_runtime-4.0.1/src/protocols.cpp +1794 -0
  111. winrt_runtime-4.0.1/src/protocols.h +34 -0
  112. winrt_runtime-4.0.1/src/pycollections.cpp +411 -0
  113. winrt_runtime-4.0.1/src/pycollections.h +251 -0
  114. winrt_runtime-4.0.1/src/pymapping.cpp +322 -0
  115. winrt_runtime-4.0.1/src/pymapping.h +25 -0
  116. winrt_runtime-4.0.1/src/pysequence.cpp +309 -0
  117. winrt_runtime-4.0.1/src/pysequence.h +26 -0
  118. winrt_runtime-4.0.1/src/runtime.cpp +625 -0
  119. winrt_runtime-4.0.1/src/runtime.h +11 -0
  120. winrt_runtime-4.0.1/src/shapes-generated.h +975 -0
  121. winrt_runtime-4.0.1/src/shapes.cpp +97 -0
  122. winrt_runtime-4.0.1/src/shapes.h +223 -0
  123. winrt_runtime-4.0.1/src/structs.cpp +1375 -0
  124. winrt_runtime-4.0.1/src/structs.h +38 -0
  125. winrt_runtime-4.0.1/src/table.cpp +1478 -0
  126. winrt_runtime-4.0.1/src/table.h +615 -0
  127. winrt_runtime-4.0.1/src/types.cpp +835 -0
  128. winrt_runtime-4.0.1/src/types.h +49 -0
  129. winrt_runtime-4.0.1/version.txt +1 -0
  130. winrt_runtime-3.2.1/PKG-INFO +0 -20
  131. winrt_runtime-3.2.1/README.md +0 -4
  132. winrt_runtime-3.2.1/_winrt.cpp +0 -853
  133. winrt_runtime-3.2.1/_winrt_array.cpp +0 -551
  134. winrt_runtime-3.2.1/_winrt_buffer.cpp +0 -59
  135. winrt_runtime-3.2.1/pyproject.toml +0 -50
  136. winrt_runtime-3.2.1/pywinrt-version.txt +0 -1
  137. winrt_runtime-3.2.1/runtime.cpp +0 -650
  138. winrt_runtime-3.2.1/setup.py +0 -33
  139. winrt_runtime-3.2.1/src/winrt/_winrt.pyi +0 -204
  140. winrt_runtime-3.2.1/src/winrt/runtime/_internals.py +0 -247
  141. winrt_runtime-3.2.1/src/winrt/runtime/interop.py +0 -3
  142. winrt_runtime-3.2.1/src/winrt/system/__init__.py +0 -113
  143. winrt_runtime-3.2.1/src/winrt/system/hresult.py +0 -48
  144. winrt_runtime-3.2.1/src/winrt_runtime.egg-info/PKG-INFO +0 -20
  145. winrt_runtime-3.2.1/src/winrt_runtime.egg-info/SOURCES.txt +0 -24
  146. {winrt_runtime-3.2.1/src → winrt_runtime-4.0.1/python}/winrt/py.typed +0 -0
  147. {winrt_runtime-3.2.1/src → winrt_runtime-4.0.1/python}/winrt/runtime/py.typed +0 -0
  148. {winrt_runtime-3.2.1/src → winrt_runtime-4.0.1/python}/winrt/system/py.typed +0 -0
  149. {winrt_runtime-3.2.1/src → winrt_runtime-4.0.1/python}/winrt_runtime.egg-info/dependency_links.txt +0 -0
  150. {winrt_runtime-3.2.1/src → winrt_runtime-4.0.1/python}/winrt_runtime.egg-info/requires.txt +0 -0
  151. {winrt_runtime-3.2.1/src → winrt_runtime-4.0.1/python}/winrt_runtime.egg-info/top_level.txt +0 -0
  152. {winrt_runtime-3.2.1 → winrt_runtime-4.0.1}/requirements.txt +0 -0
  153. {winrt_runtime-3.2.1 → winrt_runtime-4.0.1}/setup.cfg +0 -0
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+ Copyright (c) 2021-2026 David Lechner <david@pybricks.com>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE
@@ -0,0 +1,2 @@
1
+ # the headers are not installed, but building from the sdist needs them
2
+ recursive-include src *.h
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: winrt-runtime
3
+ Version: 4.0.1
4
+ Summary: The runtime that every PyWinRT projection package runs on
5
+ License-Expression: MIT
6
+ Project-URL: Documentation, https://pywinrt.readthedocs.io
7
+ Project-URL: Repository, https://github.com/pywinrt/pywinrt
8
+ Project-URL: Changelog, https://github.com/pywinrt/pywinrt/blob/main/runtime/CHANGELOG.md
9
+ Classifier: Operating System :: Microsoft :: Windows
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Python :: 3.15
16
+ Classifier: Programming Language :: Python :: Implementation :: CPython
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: typing_extensions>=4.12.2
24
+ Dynamic: license-file
25
+
26
+ # winrt-runtime
27
+
28
+ This package provides the PyWinRT runtime including the `winrt.system` module.
29
+
30
+ Every PyWinRT package requires it, so pip installs it with any of them. Each
31
+ WinRT namespace is a package of its own, so install the package of each
32
+ namespace your code imports from, such as `winrt-Windows.Foundation`.
33
+
34
+ ## For interop modules
35
+
36
+ Compiled code outside the runtime, such as the interop packages, exchanges
37
+ WinRT objects with it through the Python functions of `winrt.runtime.interop`
38
+ rather than a C ABI: `as_interface()` gives an interface of a projected object
39
+ as an interface pointer capsule, `wrap_interface()` makes a projected object of
40
+ one, and `hresult_error()` builds the exception that a failed call raises. An interface pointer capsule is named `"winrt.interface"`
41
+ and holds one reference, which its destructor releases.
@@ -0,0 +1,16 @@
1
+ # winrt-runtime
2
+
3
+ This package provides the PyWinRT runtime including the `winrt.system` module.
4
+
5
+ Every PyWinRT package requires it, so pip installs it with any of them. Each
6
+ WinRT namespace is a package of its own, so install the package of each
7
+ namespace your code imports from, such as `winrt-Windows.Foundation`.
8
+
9
+ ## For interop modules
10
+
11
+ Compiled code outside the runtime, such as the interop packages, exchanges
12
+ WinRT objects with it through the Python functions of `winrt.runtime.interop`
13
+ rather than a C ABI: `as_interface()` gives an interface of a projected object
14
+ as an interface pointer capsule, `wrap_interface()` makes a projected object of
15
+ one, and `hresult_error()` builds the exception that a failed call raises. An interface pointer capsule is named `"winrt.interface"`
16
+ and holds one reference, which its destructor releases.
@@ -0,0 +1,62 @@
1
+ # WARNING: Please don't edit this file. It was automatically generated.
2
+
3
+ [build-system]
4
+ requires = ["setuptools>=78"]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "winrt-runtime"
9
+ description = "The runtime that every PyWinRT projection package runs on"
10
+ readme = "README.md"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ classifiers = [
14
+ "Operating System :: Microsoft :: Windows",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.11",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Programming Language :: Python :: 3.14",
20
+ "Programming Language :: Python :: 3.15",
21
+ "Programming Language :: Python :: Implementation :: CPython",
22
+ "Intended Audience :: Developers",
23
+ "Programming Language :: Python :: Free Threading :: 2 - Beta",
24
+ "Typing :: Typed",
25
+ ]
26
+ dynamic = ["version", "dependencies"]
27
+ requires-python = ">=3.11"
28
+
29
+ [project.urls]
30
+ Documentation = "https://pywinrt.readthedocs.io"
31
+ Repository = "https://github.com/pywinrt/pywinrt"
32
+ Changelog = "https://github.com/pywinrt/pywinrt/blob/main/runtime/CHANGELOG.md"
33
+
34
+ [tool.setuptools.dynamic]
35
+ version = { file = "version.txt" }
36
+ dependencies = { file = "requirements.txt" }
37
+
38
+ [tool.setuptools.packages.find]
39
+ where = ["python"]
40
+
41
+ # A projection package is a table beside an __init__.py, and the type a call
42
+ # hands back is resolved by importing the module that owns it while the
43
+ # program runs. A freezer sees neither, so winrt-runtime ships the hook that
44
+ # tells PyInstaller about both, and this is how PyInstaller finds it without
45
+ # the application being frozen having to configure anything.
46
+ [project.entry-points.pyinstaller40]
47
+ hook-dirs = "winrt.__pyinstaller:get_hook_dirs"
48
+
49
+ [tool.setuptools.package-data]
50
+ "*" = ["*.pyi", "py.typed"]
51
+
52
+ [tool.cibuildwheel]
53
+ # don't build for PyPy
54
+ skip = "pp*"
55
+ # suppress warnings about ARM64 testing
56
+ test-skip = "*-win_arm64"
57
+ test-command = "python -c \"import winrt._winrt\""
58
+
59
+ [tool.cibuildwheel.windows]
60
+ archs = ["x86", "AMD64", "ARM64"]
61
+ # nothing here is copied in after the build, so there is no repair step
62
+ repair-wheel-command = ""
@@ -0,0 +1,13 @@
1
+ """
2
+ Where PyInstaller finds PyWinRT's hook.
3
+
4
+ ``winrt-runtime`` declares this module in the ``pyinstaller40`` entry point
5
+ group, so PyInstaller asks it for the directory the hook is in and needs no
6
+ configuration from the application being frozen.
7
+ """
8
+
9
+ import os
10
+
11
+
12
+ def get_hook_dirs() -> list[str]:
13
+ return [os.path.dirname(__file__)]
@@ -0,0 +1,85 @@
1
+ """
2
+ What a frozen application needs from PyWinRT that PyInstaller cannot see.
3
+
4
+ Two things are invisible to an import graph.
5
+
6
+ A projected namespace is a data file. ``winrt.windows.storage`` is an
7
+ ``__init__.py`` that asks the runtime to read the ``_table.pywinrt`` sitting
8
+ beside it, so freezing the module without the table produces an executable
9
+ that fails at import. PyInstaller collects the module and not the table.
10
+
11
+ A projected type is resolved by importing the module that owns it, by name,
12
+ while the program runs (``py::get_python_type()`` in the runtime). A call
13
+ that hands back an ``IAsyncOperation`` imports ``winrt.windows.foundation``
14
+ whether or not the application ever names it, and nothing in the source says
15
+ so. So every projection package that is installed is collected rather than
16
+ only the ones the graph reached: what an application imports says little
17
+ about which namespaces its calls return types from.
18
+
19
+ Nothing here names a Windows SDK, a Windows App SDK or any other family. What
20
+ is collected is what the installed distributions say they ship, so a
21
+ projection somebody else generated is collected on the same terms as the ones
22
+ published from this repository.
23
+ """
24
+
25
+ from importlib.metadata import distributions
26
+
27
+ # the data file a projection package carries, which
28
+ # winrt.runtime._internals.load_projection() reads from beside the module
29
+ TABLE_NAME = "_table.pywinrt"
30
+
31
+ binaries: list[tuple[str, str]] = []
32
+ datas: list[tuple[str, str]] = []
33
+ hiddenimports: list[str] = []
34
+
35
+
36
+ def _installed_files() -> list[tuple[str, str, str]]:
37
+ """
38
+ Every file of every installed distribution, as (name, package, source).
39
+
40
+ ``package`` is the dotted package the file sits in and ``source`` is where
41
+ it is now. A distribution installed from a wheel records what it put where;
42
+ one that did not record it is something this can say nothing about.
43
+ """
44
+ files: list[tuple[str, str, str]] = []
45
+
46
+ for distribution in distributions():
47
+ for file in distribution.files or []:
48
+ directory = str(file).replace("\\", "/").rpartition("/")[0]
49
+
50
+ if directory:
51
+ files.append(
52
+ (file.name, directory, str(distribution.locate_file(file)))
53
+ )
54
+
55
+ return files
56
+
57
+
58
+ def _collect() -> None:
59
+ installed = _installed_files()
60
+
61
+ # The namespace roots PyWinRT projects into are whichever ones hold a
62
+ # table, rather than a list of names kept here: the runtime has no
63
+ # business knowing which families exist.
64
+ roots = {
65
+ package.partition("/")[0]
66
+ for name, package, _ in installed
67
+ if name == TABLE_NAME
68
+ }
69
+
70
+ for name, package, source in installed:
71
+ if package.partition("/")[0] not in roots:
72
+ continue
73
+
74
+ if name == TABLE_NAME:
75
+ datas.append((source, package))
76
+ hiddenimports.append(package.replace("/", "."))
77
+
78
+ # A package that redistributes a component .dll loads it by bare name
79
+ # after putting its own directory on the DLL search path, so no import
80
+ # table mentions it and nothing else would collect it.
81
+ if name.lower().endswith(".dll"):
82
+ binaries.append((source, package))
83
+
84
+
85
+ _collect()
@@ -0,0 +1,169 @@
1
+ import abc
2
+ import collections.abc
3
+ from datetime import datetime, timedelta
4
+ import types
5
+ from typing import (
6
+ Any,
7
+ ClassVar,
8
+ Protocol,
9
+ Self,
10
+ SupportsIndex,
11
+ TypeVar,
12
+ final,
13
+ overload,
14
+ )
15
+ from collections.abc import Iterable, Iterator
16
+ from uuid import UUID
17
+
18
+ from typing_extensions import Buffer, TypeForm, deprecated
19
+
20
+ from winrt.runtime import ApartmentType
21
+ from winrt.runtime.interop import InterfaceCapsule
22
+
23
+ MTA: int
24
+ STA: int
25
+
26
+ def init_apartment(apartment_type: ApartmentType, /) -> None: ...
27
+ def uninit_apartment() -> None: ...
28
+ def initialize_with_window(obj: Object, hwnd: SupportsIndex, /) -> None: ...
29
+ def load_projection(module: types.ModuleType, table_path: str, /) -> None: ...
30
+ @overload
31
+ def as_interface(obj: Object, iid: UUID | type[Object], /) -> InterfaceCapsule: ...
32
+ @overload
33
+ def as_interface(obj: None, iid: UUID | type[Object], /) -> None: ...
34
+ def get_activation_factory(
35
+ cls: type[Object], iid: UUID | type[Object], /
36
+ ) -> InterfaceCapsule: ...
37
+ @overload
38
+ def wrap_interface(
39
+ capsule: InterfaceCapsule, type: TypeForm[_TObject], /
40
+ ) -> _TObject: ...
41
+ @overload
42
+ def wrap_interface(capsule: InterfaceCapsule, qualified_name: str, /) -> Any: ...
43
+ @overload
44
+ def wrap_interface(capsule: None, type: type[Object] | str, /) -> None: ...
45
+ def hresult_error(
46
+ hresult: SupportsIndex, error_info: InterfaceCapsule | None = None, /
47
+ ) -> OSError: ...
48
+ def box_boolean(value: bool, /) -> Object: ...
49
+ def box_int8(value: SupportsIndex, /) -> Object: ...
50
+ def box_uint8(value: SupportsIndex, /) -> Object: ...
51
+ def box_int16(value: SupportsIndex, /) -> Object: ...
52
+ def box_uint16(value: SupportsIndex, /) -> Object: ...
53
+ def box_int32(value: SupportsIndex, /) -> Object: ...
54
+ def box_uint32(value: SupportsIndex, /) -> Object: ...
55
+ def box_int64(value: SupportsIndex, /) -> Object: ...
56
+ def box_uint64(value: SupportsIndex, /) -> Object: ...
57
+ def box_single(value: float, /) -> Object: ...
58
+ def box_double(value: float, /) -> Object: ...
59
+ def box_char16(value: str, /) -> Object: ...
60
+ def box_string(value: str, /) -> Object: ...
61
+ def box_guid(value: UUID, /) -> Object: ...
62
+ def box_date_time(value: datetime, /) -> Object: ...
63
+ def box_time_span(value: timedelta, /) -> Object: ...
64
+ def unbox_boolean(value: Object, /) -> bool: ...
65
+ def unbox_int8(value: Object, /) -> int: ...
66
+ def unbox_uint8(value: Object, /) -> int: ...
67
+ def unbox_int16(value: Object, /) -> int: ...
68
+ def unbox_uint16(value: Object, /) -> int: ...
69
+ def unbox_int32(value: Object, /) -> int: ...
70
+ def unbox_uint32(value: Object, /) -> int: ...
71
+ def unbox_int64(value: Object, /) -> int: ...
72
+ def unbox_uint64(value: Object, /) -> int: ...
73
+ def unbox_single(value: Object, /) -> float: ...
74
+ def unbox_double(value: Object, /) -> float: ...
75
+ def unbox_char16(value: Object, /) -> str: ...
76
+ def unbox_string(value: Object, /) -> str: ...
77
+ def unbox_guid(value: Object, /) -> UUID: ...
78
+ def unbox_date_time(value: Object, /) -> datetime: ...
79
+ def unbox_time_span(value: Object, /) -> timedelta: ...
80
+
81
+ # Reads a projection table and returns its contents as plain Python objects, so
82
+ # that test/test_table.py can check that the generator's writer and this
83
+ # module's reader agree on the format. The shape of the result follows
84
+ # runtime/src/table-format.md rather than a type of its own.
85
+ def read_table(data: Buffer, /) -> dict[str, Any]: ...
86
+
87
+ _T = TypeVar("_T")
88
+ _TObject = TypeVar("_TObject", bound=Object)
89
+
90
+ # What as_() asks of the type it is given, a projected one or an interop
91
+ # interface alike: as_(type) is type._query_interface_(obj).
92
+ class _SupportsQueryInterface(Protocol):
93
+ @classmethod
94
+ def _query_interface_(cls, obj: Object, /) -> Self: ...
95
+
96
+ _TQueryInterface = TypeVar("_TQueryInterface", bound=_SupportsQueryInterface)
97
+
98
+ # Declared as an ABCMeta although at run time it derives from type: a type
99
+ # checker requires an abstract member to be implemented only under ABCMeta, and
100
+ # the members of an interface are abstract.
101
+ class Object_Static(abc.ABCMeta):
102
+ def __instancecheck__(self, instance: Any) -> bool: ...
103
+ def __subclasscheck__(self, subclass: type) -> bool: ...
104
+
105
+ # The type of everything WinRT can hold. A Python class that implements a WinRT
106
+ # interface derives from the projected name of that interface, and therefore
107
+ # from this, without being a wrapper around a WinRT object (at run time it does
108
+ # not derive from Object, and isinstance() says it is one all the same): the
109
+ # runtime gives it the three members below as it gives a wrapper. The members
110
+ # of the interface itself are abstract, because implementing them is what
111
+ # deriving from it means.
112
+ class Object(metaclass=Object_Static):
113
+ def as_(self, type: TypeForm[_TQueryInterface], /) -> _TQueryInterface: ...
114
+ @property
115
+ def _iids_(self) -> Array[UUID]: ...
116
+ @property
117
+ def _runtime_class_name_(self) -> str: ...
118
+ # what as_() calls, which the runtime gives the projected name of an
119
+ # interface as well as the wrapper
120
+ @classmethod
121
+ def _query_interface_(cls, obj: Object, /) -> Self: ...
122
+
123
+ @final
124
+ class Array(collections.abc.Sequence[_T]):
125
+ _winrt_element_type_name_: str
126
+ def __class_getitem__(cls, key: Any) -> types.GenericAlias: ...
127
+ @overload
128
+ def __init__(self, type: TypeForm[_T], /) -> None: ...
129
+ @overload
130
+ def __init__(
131
+ self,
132
+ type: TypeForm[_T],
133
+ size: SupportsIndex,
134
+ /,
135
+ ) -> None: ...
136
+ @overload
137
+ def __init__(
138
+ self,
139
+ type: TypeForm[_T],
140
+ initializer: Buffer,
141
+ /,
142
+ ) -> None: ...
143
+ @overload
144
+ def __init__(
145
+ self,
146
+ type: TypeForm[_T],
147
+ initializer: Iterable[_T],
148
+ /,
149
+ ) -> None: ...
150
+ @overload
151
+ @deprecated("Passing a format string to Array is deprecated: pass the type instead")
152
+ def __init__(
153
+ self,
154
+ type: str,
155
+ initializer: SupportsIndex | Buffer | Iterable[Any],
156
+ /,
157
+ ) -> None: ...
158
+ def __buffer__(self, flags: int, /) -> memoryview: ...
159
+ def __release_buffer__(self, view: memoryview, /) -> None: ...
160
+ def __len__(self) -> int: ...
161
+ @overload
162
+ def __getitem__(self, index: SupportsIndex) -> _T: ...
163
+ @overload
164
+ def __getitem__(self, index: slice) -> Array[_T]: ...
165
+ def __setitem__(self, index: SupportsIndex, value: _T) -> None: ...
166
+ def __iter__(self) -> Iterator[_T]: ...
167
+ def __eq__(self, other: object, /) -> bool: ...
168
+ def __ne__(self, other: object, /) -> bool: ...
169
+ __hash__: ClassVar[None] # type: ignore[assignment]
@@ -1,5 +1,12 @@
1
1
  from enum import IntEnum
2
2
 
3
+ # winrt._winrt imports uuid when it loads, from compiled code, where a freezer
4
+ # that follows a program's imports cannot see it. Everything that loads the
5
+ # runtime imports this package, so saying it here puts uuid in the bundle.
6
+ import uuid
7
+
8
+ del uuid
9
+
3
10
  from winrt._winrt import init_apartment, uninit_apartment, STA, MTA
4
11
 
5
12