| 1 | From 537c09d25e652acfdb305159134a5e0585a0f21d Mon Sep 17 00:00:00 2001
|
| 2 | From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?=
|
| 3 | <[email protected]>
|
| 4 | Date: Fri, 22 May 2026 10:56:48 +0200
|
| 5 | Subject: [PATCH 2/2] build: make IRC mirror integration script installable.
|
| 6 |
|
| 7 | This change was originally proposed by Sharlatan Hellseher:
|
| 8 | https://codeberg.org/guix/guix/pulls/7418#issuecomment-12239616
|
| 9 |
|
| 10 | * zulip/integrations/bridge_with_irc/irc-mirror.py: Rename file to
|
| 11 | 'irc_mirror.py' to make it importable as a Python module.
|
| 12 |
|
| 13 | * zulip/integrations/bridge_with_irc/irc_mirror.py: Introduce `main' entry point
|
| 14 | so it can be used as a setuptools console script entry point.
|
| 15 |
|
| 16 | * zulip/setup.py: Register 'zulip-irc-bridge' as a console script so it's
|
| 17 | installed as part of the package output.
|
| 18 |
|
| 19 | This patch won't be needed once the following issue is merged upstream:
|
| 20 | https://github.com/zulip/python-zulip-api/pull/917
|
| 21 | ---
|
| 22 | .../bridge_with_irc/{irc-mirror.py => irc_mirror.py} | 7 +++++--
|
| 23 | zulip/setup.py | 1 +
|
| 24 | 2 files changed, 6 insertions(+), 2 deletions(-)
|
| 25 | rename zulip/integrations/bridge_with_irc/{irc-mirror.py => irc_mirror.py} (96%)
|
| 26 |
|
| 27 | diff --git a/zulip/integrations/bridge_with_irc/irc-mirror.py b/zulip/integrations/bridge_with_irc/irc_mirror.py
|
| 28 | similarity index 96%
|
| 29 | rename from zulip/integrations/bridge_with_irc/irc-mirror.py
|
| 30 | rename to zulip/integrations/bridge_with_irc/irc_mirror.py
|
| 31 | index 7aaca7b9..b0d3ff65 100755
|
| 32 | |
| 33 | |
| 34 | @@ -27,7 +27,7 @@ Specify your Zulip API credentials and server in a ~/.zuliprc file or using the
|
| 35 | Note that "_zulip" will be automatically appended to the IRC nick provided
|
| 36 | """
|
| 37 |
|
| 38 | -if __name__ == "__main__":
|
| 39 | +def main():
|
| 40 | parser = zulip.add_default_arguments(
|
| 41 | argparse.ArgumentParser(usage=usage), allow_provisioning=True
|
| 42 | )
|
| 43 | @@ -45,7 +45,7 @@ if __name__ == "__main__":
|
| 44 | options.client = "irc_mirror"
|
| 45 | zulip_client = zulip.init_from_options(options)
|
| 46 | try:
|
| 47 | - from irc_mirror_backend import IRCBot
|
| 48 | + from .irc_mirror_backend import IRCBot
|
| 49 | except ImportError:
|
| 50 | traceback.print_exc()
|
| 51 | print(
|
| 52 | @@ -70,3 +70,6 @@ if __name__ == "__main__":
|
| 53 | sasl_password=options.sasl_password,
|
| 54 | )
|
| 55 | bot.start()
|
| 56 | +
|
| 57 | +if __name__ == "__main__":
|
| 58 | + main()
|
| 59 | diff --git a/zulip/setup.py b/zulip/setup.py
|
| 60 | index 097bc684..236e5d74 100755
|
| 61 | |
| 62 | |
| 63 | @@ -60,6 +60,7 @@ setup(
|
| 64 | "zulip-send=zulip.send:main",
|
| 65 | "zulip-api-examples=zulip.api_examples:main",
|
| 66 | "zulip-matrix-bridge=integrations.bridge_with_matrix.matrix_bridge:main",
|
| 67 | + "zulip-irc-bridge=integrations.bridge_with_irc.irc_mirror:main",
|
| 68 | "zulip-api=zulip.cli:cli",
|
| 69 | ],
|
| 70 | },
|
| 71 | --
|
| 72 | 2.54.0
|
| 73 |
|