Package: sip5 / 5.5.0+dfsg-3

py_typed.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From: Dmitry Shachnev <mitya57@debian.org>
Date: Sat, 2 Jan 2021 11:33:18 +0000
Subject: py.typed is installed if dunder-init is specified

And at least one set of bindings has pep484-pyi specified.

This is a part of upstream change that was made in SIP v6, see:
https://riverbankcomputing.com/hg/sip/rev/f4975184730a
---
 sipbuild/builder.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sipbuild/builder.py b/sipbuild/builder.py
index fb38c97..b7bacf8 100644
--- a/sipbuild/builder.py
+++ b/sipbuild/builder.py
@@ -329,6 +329,20 @@ class Builder(AbstractBuilder):
             installable.files.append(init_path)
             project.installables.append(installable)
 
+            for bindings in project.bindings.values():
+                if bindings.pep484_pyi:
+                    # Create a PEP 561 marker file.
+                    py_typed_path = os.path.join(project.build_dir, 'py.typed')
+                    with open(py_typed_path, 'w'):
+                        pass
+
+                    installable = Installable('py_typed',
+                            target_subdir=project.get_package_dir())
+                    installable.files.append(py_typed_path)
+                    project.installables.append(installable)
+
+                    break
+
         # Create the .api file if required.
         if project.api_dir:
             api_fn = project.name + '.api'