We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Build packages for Debian Trixie
Please can we publish packages to the apt repository for [Debian Trixie (13)](https://wiki.debian.org/DebianTrixie) which is the current testing release at the time of writing. It became the current testing release on 2023-06-10.

I run debian testing on the server I run synapse on and the change from bookworm to trixie has meant that I now get errors on `apt update`:

```
E: The repository 'https://packages.matrix.org/debian trixie Release' does not have a Release file.
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scripts-dev/build_debian_packages.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 # Build the Debian packages using Docker images.
4 #
5 # This script builds the Docker images and then executes them sequentially, each
6 # one building a Debian package for the targeted operating system. It is
7 # designed to be a "single command" to produce all the images.
8 #
9 # By default, builds for all known distributions, but a list of distributions
10 # can be passed on the commandline for debugging.
11 
12 import argparse
13 import json
14 import os
15 import signal
16 import subprocess
17 import sys
18 import threading
19 from concurrent.futures import ThreadPoolExecutor
20 from types import FrameType
21 from typing import Collection, Optional, Sequence, Set
22 
23 # These are expanded inside the dockerfile to be a fully qualified image name.
24 # e.g. docker.io/library/debian:bullseye
25 #
26 # If an EOL is forced by a Python version and we're dropping support for it, make sure
27 # to remove references to the distibution across Synapse (search for "bullseye" for
28 # example)
29 DISTS = (
30     "debian:bullseye",  # (EOL ~2024-07) (our EOL forced by Python 3.9 is 2025-10-05)
31     "debian:bookworm",  # (EOL not specified yet) (our EOL forced by Python 3.11 is 2027-10-24)
32     "debian:sid",  # (EOL not specified yet) (our EOL forced by Python 3.11 is 2027-10-24)
33     "ubuntu:focal",  # 20.04 LTS (EOL 2025-04) (our EOL forced by Python 3.8 is 2024-10-14)
34     "ubuntu:jammy",  # 22.04 LTS (EOL 2027-04) (our EOL forced by Python 3.10 is 2026-10-04)
35     "ubuntu:kinetic",  # 22.10 (EOL 2023-07-20) (our EOL forced by Python 3.10 is 2026-10-04)
36     "ubuntu:lunar",  # 23.04 (EOL 2024-01) (our EOL forced by Python 3.11 is 2027-10-24)
37 )
38 
39 DESC = """\
40 Builds .debs for synapse, using a Docker image for the build environment.
41 
42 By default, builds for all known distributions, but a list of distributions
43 can be passed on the commandline for debugging.
44 """
45 
46 projdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
47 
48 
49 class Builder(object):
50     def __init__(
51         self,
52         redirect_stdout: bool = False,
53         docker_build_args: Optional[Sequence[str]] = None,
54     ):
55         self.redirect_stdout = redirect_stdout
56         self._docker_build_args = tuple(docker_build_args or ())
57         self.active_containers: Set[str] = set()
58         self._lock = threading.Lock()
59         self._failed = False
60 
61     def run_build(self, dist: str, skip_tests: bool = False) -> None:
62         """Build deb for a single distribution"""
63 
64         if self._failed:
65             print("not building %s due to earlier failure" % (dist,))
66             raise Exception("failed")
67 
68         try:
69             self._inner_build(dist, skip_tests)
70         except Exception as e:
71             print("build of %s failed: %s" % (dist, e), file=sys.stderr)
72             self._failed = True
73             raise
74 
75     def _inner_build(self, dist: str, skip_tests: bool = False) -> None:
76         tag = dist.split(":", 1)[1]
77 
78         # Make the dir where the debs will live.
79         #
80         # Note that we deliberately put this outside the source tree, otherwise
81         # we tend to get source packages which are full of debs. (We could hack
82         # around that with more magic in the build_debian.sh script, but that
83         # doesn't solve the problem for natively-run dpkg-buildpakage).
84         debsdir = os.path.join(projdir, "../debs")
85         os.makedirs(debsdir, exist_ok=True)
86 
87         if self.redirect_stdout:
88             logfile = os.path.join(debsdir, "%s.buildlog" % (tag,))
89             print("building %s: directing output to %s" % (dist, logfile))
90             stdout = open(logfile, "w")
91         else:
92             stdout = None
93 
94         # first build a docker image for the build environment
95         build_args = (
96             (
97                 "docker",
98                 "build",
99                 "--tag",
100                 "dh-venv-builder:" + tag,
101                 "--build-arg",
102                 "distro=" + dist,
103                 "-f",
104                 "docker/Dockerfile-dhvirtualenv",
105             )
106             + self._docker_build_args
107             + ("docker",)
108         )
109 
110         subprocess.check_call(
111             build_args,
112             stdout=stdout,
113             stderr=subprocess.STDOUT,
114             cwd=projdir,
115         )
116 
117         container_name = "synapse_build_" + tag
118         with self._lock:
119             self.active_containers.add(container_name)
120 
121         # then run the build itself
122         subprocess.check_call(
123             [
124                 "docker",
125                 "run",
126                 "--rm",
127                 "--name",
128                 container_name,
129                 "--volume=" + projdir + ":/synapse/source:ro",
130                 "--volume=" + debsdir + ":/debs",
131                 "-e",
132                 "TARGET_USERID=%i" % (os.getuid(),),
133                 "-e",
134                 "TARGET_GROUPID=%i" % (os.getgid(),),
135                 "-e",
136                 "DEB_BUILD_OPTIONS=%s" % ("nocheck" if skip_tests else ""),
137                 "dh-venv-builder:" + tag,
138             ],
139             stdout=stdout,
140             stderr=subprocess.STDOUT,
141         )
142 
143         with self._lock:
144             self.active_containers.remove(container_name)
145 
146         if stdout is not None:
147             stdout.close()
148             print("Completed build of %s" % (dist,))
149 
150     def kill_containers(self) -> None:
151         with self._lock:
152             active = list(self.active_containers)
153 
154         for c in active:
155             print("killing container %s" % (c,))
156             subprocess.run(
157                 [
158                     "docker",
159                     "kill",
160                     c,
161                 ],
162                 stdout=subprocess.DEVNULL,
163             )
164             with self._lock:
165                 self.active_containers.remove(c)
166 
167 
168 def run_builds(
169     builder: Builder, dists: Collection[str], jobs: int = 1, skip_tests: bool = False
170 ) -> None:
171     def sig(signum: int, _frame: Optional[FrameType]) -> None:
172         print("Caught SIGINT")
173         builder.kill_containers()
174 
175     signal.signal(signal.SIGINT, sig)
176 
177     with ThreadPoolExecutor(max_workers=jobs) as e:
178         res = e.map(lambda dist: builder.run_build(dist, skip_tests), dists)
179 
180     # make sure we consume the iterable so that exceptions are raised.
181     for _ in res:
182         pass
183 
184 
185 if __name__ == "__main__":
186     parser = argparse.ArgumentParser(
187         description=DESC,
188     )
189     parser.add_argument(
190         "-j",
191         "--jobs",
192         type=int,
193         default=1,
194         help="specify the number of builds to run in parallel",
195     )
196     parser.add_argument(
197         "--no-check",
198         action="store_true",
199         help="skip running tests after building",
200     )
201     parser.add_argument(
202         "--docker-build-arg",
203         action="append",
204         help="specify an argument to pass to docker build",
205     )
206     parser.add_argument(
207         "--show-dists-json",
208         action="store_true",
209         help="instead of building the packages, just list the dists to build for, as a json array",
210     )
211     parser.add_argument(
212         "dist",
213         nargs="*",
214         default=DISTS,
215         help="a list of distributions to build for. Default: %(default)s",
216     )
217     args = parser.parse_args()
218     if args.show_dists_json:
219         print(json.dumps(DISTS))
220     else:
221         builder = Builder(
222             redirect_stdout=(args.jobs > 1), docker_build_args=args.docker_build_arg
223         )
224         run_builds(
225             builder,
226             dists=args.dist,
227             jobs=args.jobs,
228             skip_tests=args.no_check,
229         )
230
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/scripts-dev/build_debian_packages.py b/scripts-dev/build_debian_packages.py
--- a/scripts-dev/build_debian_packages.py
+++ b/scripts-dev/build_debian_packages.py
@@ -34,6 +34,7 @@
     "ubuntu:jammy",  # 22.04 LTS (EOL 2027-04) (our EOL forced by Python 3.10 is 2026-10-04)
     "ubuntu:kinetic",  # 22.10 (EOL 2023-07-20) (our EOL forced by Python 3.10 is 2026-10-04)
     "ubuntu:lunar",  # 23.04 (EOL 2024-01) (our EOL forced by Python 3.11 is 2027-10-24)
+    "debian:trixie",  # (EOL not specified yet)
 )
 
 DESC = """\

{"golden_diff": "diff --git a/scripts-dev/build_debian_packages.py b/scripts-dev/build_debian_packages.py\n--- a/scripts-dev/build_debian_packages.py\n+++ b/scripts-dev/build_debian_packages.py\n@@ -34,6 +34,7 @@\n     \"ubuntu:jammy\",  # 22.04 LTS (EOL 2027-04) (our EOL forced by Python 3.10 is 2026-10-04)\n     \"ubuntu:kinetic\",  # 22.10 (EOL 2023-07-20) (our EOL forced by Python 3.10 is 2026-10-04)\n     \"ubuntu:lunar\",  # 23.04 (EOL 2024-01) (our EOL forced by Python 3.11 is 2027-10-24)\n+    \"debian:trixie\",  # (EOL not specified yet)\n )\n \n DESC = \"\"\"\\\n", "issue": "Build packages for Debian Trixie\nPlease can we publish packages to the apt repository for [Debian Trixie (13)](https://wiki.debian.org/DebianTrixie) which is the current testing release at the time of writing. It became the current testing release on 2023-06-10.\r\n\r\nI run debian testing on the server I run synapse on and the change from bookworm to trixie has meant that I now get errors on `apt update`:\r\n\r\n```\r\nE: The repository 'https://packages.matrix.org/debian trixie Release' does not have a Release file.\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python3\n\n# Build the Debian packages using Docker images.\n#\n# This script builds the Docker images and then executes them sequentially, each\n# one building a Debian package for the targeted operating system. It is\n# designed to be a \"single command\" to produce all the images.\n#\n# By default, builds for all known distributions, but a list of distributions\n# can be passed on the commandline for debugging.\n\nimport argparse\nimport json\nimport os\nimport signal\nimport subprocess\nimport sys\nimport threading\nfrom concurrent.futures import ThreadPoolExecutor\nfrom types import FrameType\nfrom typing import Collection, Optional, Sequence, Set\n\n# These are expanded inside the dockerfile to be a fully qualified image name.\n# e.g. docker.io/library/debian:bullseye\n#\n# If an EOL is forced by a Python version and we're dropping support for it, make sure\n# to remove references to the distibution across Synapse (search for \"bullseye\" for\n# example)\nDISTS = (\n    \"debian:bullseye\",  # (EOL ~2024-07) (our EOL forced by Python 3.9 is 2025-10-05)\n    \"debian:bookworm\",  # (EOL not specified yet) (our EOL forced by Python 3.11 is 2027-10-24)\n    \"debian:sid\",  # (EOL not specified yet) (our EOL forced by Python 3.11 is 2027-10-24)\n    \"ubuntu:focal\",  # 20.04 LTS (EOL 2025-04) (our EOL forced by Python 3.8 is 2024-10-14)\n    \"ubuntu:jammy\",  # 22.04 LTS (EOL 2027-04) (our EOL forced by Python 3.10 is 2026-10-04)\n    \"ubuntu:kinetic\",  # 22.10 (EOL 2023-07-20) (our EOL forced by Python 3.10 is 2026-10-04)\n    \"ubuntu:lunar\",  # 23.04 (EOL 2024-01) (our EOL forced by Python 3.11 is 2027-10-24)\n)\n\nDESC = \"\"\"\\\nBuilds .debs for synapse, using a Docker image for the build environment.\n\nBy default, builds for all known distributions, but a list of distributions\ncan be passed on the commandline for debugging.\n\"\"\"\n\nprojdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))\n\n\nclass Builder(object):\n    def __init__(\n        self,\n        redirect_stdout: bool = False,\n        docker_build_args: Optional[Sequence[str]] = None,\n    ):\n        self.redirect_stdout = redirect_stdout\n        self._docker_build_args = tuple(docker_build_args or ())\n        self.active_containers: Set[str] = set()\n        self._lock = threading.Lock()\n        self._failed = False\n\n    def run_build(self, dist: str, skip_tests: bool = False) -> None:\n        \"\"\"Build deb for a single distribution\"\"\"\n\n        if self._failed:\n            print(\"not building %s due to earlier failure\" % (dist,))\n            raise Exception(\"failed\")\n\n        try:\n            self._inner_build(dist, skip_tests)\n        except Exception as e:\n            print(\"build of %s failed: %s\" % (dist, e), file=sys.stderr)\n            self._failed = True\n            raise\n\n    def _inner_build(self, dist: str, skip_tests: bool = False) -> None:\n        tag = dist.split(\":\", 1)[1]\n\n        # Make the dir where the debs will live.\n        #\n        # Note that we deliberately put this outside the source tree, otherwise\n        # we tend to get source packages which are full of debs. (We could hack\n        # around that with more magic in the build_debian.sh script, but that\n        # doesn't solve the problem for natively-run dpkg-buildpakage).\n        debsdir = os.path.join(projdir, \"../debs\")\n        os.makedirs(debsdir, exist_ok=True)\n\n        if self.redirect_stdout:\n            logfile = os.path.join(debsdir, \"%s.buildlog\" % (tag,))\n            print(\"building %s: directing output to %s\" % (dist, logfile))\n            stdout = open(logfile, \"w\")\n        else:\n            stdout = None\n\n        # first build a docker image for the build environment\n        build_args = (\n            (\n                \"docker\",\n                \"build\",\n                \"--tag\",\n                \"dh-venv-builder:\" + tag,\n                \"--build-arg\",\n                \"distro=\" + dist,\n                \"-f\",\n                \"docker/Dockerfile-dhvirtualenv\",\n            )\n            + self._docker_build_args\n            + (\"docker\",)\n        )\n\n        subprocess.check_call(\n            build_args,\n            stdout=stdout,\n            stderr=subprocess.STDOUT,\n            cwd=projdir,\n        )\n\n        container_name = \"synapse_build_\" + tag\n        with self._lock:\n            self.active_containers.add(container_name)\n\n        # then run the build itself\n        subprocess.check_call(\n            [\n                \"docker\",\n                \"run\",\n                \"--rm\",\n                \"--name\",\n                container_name,\n                \"--volume=\" + projdir + \":/synapse/source:ro\",\n                \"--volume=\" + debsdir + \":/debs\",\n                \"-e\",\n                \"TARGET_USERID=%i\" % (os.getuid(),),\n                \"-e\",\n                \"TARGET_GROUPID=%i\" % (os.getgid(),),\n                \"-e\",\n                \"DEB_BUILD_OPTIONS=%s\" % (\"nocheck\" if skip_tests else \"\"),\n                \"dh-venv-builder:\" + tag,\n            ],\n            stdout=stdout,\n            stderr=subprocess.STDOUT,\n        )\n\n        with self._lock:\n            self.active_containers.remove(container_name)\n\n        if stdout is not None:\n            stdout.close()\n            print(\"Completed build of %s\" % (dist,))\n\n    def kill_containers(self) -> None:\n        with self._lock:\n            active = list(self.active_containers)\n\n        for c in active:\n            print(\"killing container %s\" % (c,))\n            subprocess.run(\n                [\n                    \"docker\",\n                    \"kill\",\n                    c,\n                ],\n                stdout=subprocess.DEVNULL,\n            )\n            with self._lock:\n                self.active_containers.remove(c)\n\n\ndef run_builds(\n    builder: Builder, dists: Collection[str], jobs: int = 1, skip_tests: bool = False\n) -> None:\n    def sig(signum: int, _frame: Optional[FrameType]) -> None:\n        print(\"Caught SIGINT\")\n        builder.kill_containers()\n\n    signal.signal(signal.SIGINT, sig)\n\n    with ThreadPoolExecutor(max_workers=jobs) as e:\n        res = e.map(lambda dist: builder.run_build(dist, skip_tests), dists)\n\n    # make sure we consume the iterable so that exceptions are raised.\n    for _ in res:\n        pass\n\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser(\n        description=DESC,\n    )\n    parser.add_argument(\n        \"-j\",\n        \"--jobs\",\n        type=int,\n        default=1,\n        help=\"specify the number of builds to run in parallel\",\n    )\n    parser.add_argument(\n        \"--no-check\",\n        action=\"store_true\",\n        help=\"skip running tests after building\",\n    )\n    parser.add_argument(\n        \"--docker-build-arg\",\n        action=\"append\",\n        help=\"specify an argument to pass to docker build\",\n    )\n    parser.add_argument(\n        \"--show-dists-json\",\n        action=\"store_true\",\n        help=\"instead of building the packages, just list the dists to build for, as a json array\",\n    )\n    parser.add_argument(\n        \"dist\",\n        nargs=\"*\",\n        default=DISTS,\n        help=\"a list of distributions to build for. Default: %(default)s\",\n    )\n    args = parser.parse_args()\n    if args.show_dists_json:\n        print(json.dumps(DISTS))\n    else:\n        builder = Builder(\n            redirect_stdout=(args.jobs > 1), docker_build_args=args.docker_build_arg\n        )\n        run_builds(\n            builder,\n            dists=args.dist,\n            jobs=args.jobs,\n            skip_tests=args.no_check,\n        )\n", "path": "scripts-dev/build_debian_packages.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\n# Build the Debian packages using Docker images.\n#\n# This script builds the Docker images and then executes them sequentially, each\n# one building a Debian package for the targeted operating system. It is\n# designed to be a \"single command\" to produce all the images.\n#\n# By default, builds for all known distributions, but a list of distributions\n# can be passed on the commandline for debugging.\n\nimport argparse\nimport json\nimport os\nimport signal\nimport subprocess\nimport sys\nimport threading\nfrom concurrent.futures import ThreadPoolExecutor\nfrom types import FrameType\nfrom typing import Collection, Optional, Sequence, Set\n\n# These are expanded inside the dockerfile to be a fully qualified image name.\n# e.g. docker.io/library/debian:bullseye\n#\n# If an EOL is forced by a Python version and we're dropping support for it, make sure\n# to remove references to the distibution across Synapse (search for \"bullseye\" for\n# example)\nDISTS = (\n    \"debian:bullseye\",  # (EOL ~2024-07) (our EOL forced by Python 3.9 is 2025-10-05)\n    \"debian:bookworm\",  # (EOL not specified yet) (our EOL forced by Python 3.11 is 2027-10-24)\n    \"debian:sid\",  # (EOL not specified yet) (our EOL forced by Python 3.11 is 2027-10-24)\n    \"ubuntu:focal\",  # 20.04 LTS (EOL 2025-04) (our EOL forced by Python 3.8 is 2024-10-14)\n    \"ubuntu:jammy\",  # 22.04 LTS (EOL 2027-04) (our EOL forced by Python 3.10 is 2026-10-04)\n    \"ubuntu:kinetic\",  # 22.10 (EOL 2023-07-20) (our EOL forced by Python 3.10 is 2026-10-04)\n    \"ubuntu:lunar\",  # 23.04 (EOL 2024-01) (our EOL forced by Python 3.11 is 2027-10-24)\n    \"debian:trixie\",  # (EOL not specified yet)\n)\n\nDESC = \"\"\"\\\nBuilds .debs for synapse, using a Docker image for the build environment.\n\nBy default, builds for all known distributions, but a list of distributions\ncan be passed on the commandline for debugging.\n\"\"\"\n\nprojdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))\n\n\nclass Builder(object):\n    def __init__(\n        self,\n        redirect_stdout: bool = False,\n        docker_build_args: Optional[Sequence[str]] = None,\n    ):\n        self.redirect_stdout = redirect_stdout\n        self._docker_build_args = tuple(docker_build_args or ())\n        self.active_containers: Set[str] = set()\n        self._lock = threading.Lock()\n        self._failed = False\n\n    def run_build(self, dist: str, skip_tests: bool = False) -> None:\n        \"\"\"Build deb for a single distribution\"\"\"\n\n        if self._failed:\n            print(\"not building %s due to earlier failure\" % (dist,))\n            raise Exception(\"failed\")\n\n        try:\n            self._inner_build(dist, skip_tests)\n        except Exception as e:\n            print(\"build of %s failed: %s\" % (dist, e), file=sys.stderr)\n            self._failed = True\n            raise\n\n    def _inner_build(self, dist: str, skip_tests: bool = False) -> None:\n        tag = dist.split(\":\", 1)[1]\n\n        # Make the dir where the debs will live.\n        #\n        # Note that we deliberately put this outside the source tree, otherwise\n        # we tend to get source packages which are full of debs. (We could hack\n        # around that with more magic in the build_debian.sh script, but that\n        # doesn't solve the problem for natively-run dpkg-buildpakage).\n        debsdir = os.path.join(projdir, \"../debs\")\n        os.makedirs(debsdir, exist_ok=True)\n\n        if self.redirect_stdout:\n            logfile = os.path.join(debsdir, \"%s.buildlog\" % (tag,))\n            print(\"building %s: directing output to %s\" % (dist, logfile))\n            stdout = open(logfile, \"w\")\n        else:\n            stdout = None\n\n        # first build a docker image for the build environment\n        build_args = (\n            (\n                \"docker\",\n                \"build\",\n                \"--tag\",\n                \"dh-venv-builder:\" + tag,\n                \"--build-arg\",\n                \"distro=\" + dist,\n                \"-f\",\n                \"docker/Dockerfile-dhvirtualenv\",\n            )\n            + self._docker_build_args\n            + (\"docker\",)\n        )\n\n        subprocess.check_call(\n            build_args,\n            stdout=stdout,\n            stderr=subprocess.STDOUT,\n            cwd=projdir,\n        )\n\n        container_name = \"synapse_build_\" + tag\n        with self._lock:\n            self.active_containers.add(container_name)\n\n        # then run the build itself\n        subprocess.check_call(\n            [\n                \"docker\",\n                \"run\",\n                \"--rm\",\n                \"--name\",\n                container_name,\n                \"--volume=\" + projdir + \":/synapse/source:ro\",\n                \"--volume=\" + debsdir + \":/debs\",\n                \"-e\",\n                \"TARGET_USERID=%i\" % (os.getuid(),),\n                \"-e\",\n                \"TARGET_GROUPID=%i\" % (os.getgid(),),\n                \"-e\",\n                \"DEB_BUILD_OPTIONS=%s\" % (\"nocheck\" if skip_tests else \"\"),\n                \"dh-venv-builder:\" + tag,\n            ],\n            stdout=stdout,\n            stderr=subprocess.STDOUT,\n        )\n\n        with self._lock:\n            self.active_containers.remove(container_name)\n\n        if stdout is not None:\n            stdout.close()\n            print(\"Completed build of %s\" % (dist,))\n\n    def kill_containers(self) -> None:\n        with self._lock:\n            active = list(self.active_containers)\n\n        for c in active:\n            print(\"killing container %s\" % (c,))\n            subprocess.run(\n                [\n                    \"docker\",\n                    \"kill\",\n                    c,\n                ],\n                stdout=subprocess.DEVNULL,\n            )\n            with self._lock:\n                self.active_containers.remove(c)\n\n\ndef run_builds(\n    builder: Builder, dists: Collection[str], jobs: int = 1, skip_tests: bool = False\n) -> None:\n    def sig(signum: int, _frame: Optional[FrameType]) -> None:\n        print(\"Caught SIGINT\")\n        builder.kill_containers()\n\n    signal.signal(signal.SIGINT, sig)\n\n    with ThreadPoolExecutor(max_workers=jobs) as e:\n        res = e.map(lambda dist: builder.run_build(dist, skip_tests), dists)\n\n    # make sure we consume the iterable so that exceptions are raised.\n    for _ in res:\n        pass\n\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser(\n        description=DESC,\n    )\n    parser.add_argument(\n        \"-j\",\n        \"--jobs\",\n        type=int,\n        default=1,\n        help=\"specify the number of builds to run in parallel\",\n    )\n    parser.add_argument(\n        \"--no-check\",\n        action=\"store_true\",\n        help=\"skip running tests after building\",\n    )\n    parser.add_argument(\n        \"--docker-build-arg\",\n        action=\"append\",\n        help=\"specify an argument to pass to docker build\",\n    )\n    parser.add_argument(\n        \"--show-dists-json\",\n        action=\"store_true\",\n        help=\"instead of building the packages, just list the dists to build for, as a json array\",\n    )\n    parser.add_argument(\n        \"dist\",\n        nargs=\"*\",\n        default=DISTS,\n        help=\"a list of distributions to build for. Default: %(default)s\",\n    )\n    args = parser.parse_args()\n    if args.show_dists_json:\n        print(json.dumps(DISTS))\n    else:\n        builder = Builder(\n            redirect_stdout=(args.jobs > 1), docker_build_args=args.docker_build_arg\n        )\n        run_builds(\n            builder,\n            dists=args.dist,\n            jobs=args.jobs,\n            skip_tests=args.no_check,\n        )\n", "path": "scripts-dev/build_debian_packages.py"}]}