Commit graph

509 commits

Author SHA1 Message Date
Robert Imschweiler 41ec1a9a29 matrix bridge: Improve mime-type detection. 2022-09-22 09:13:19 -07:00
Anders Kaseorg 92120914f8 process_ccache: Adjust supervisor_path to avoid Puppet purging.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-09-13 16:43:40 -07:00
Anders Kaseorg a534446315 zephyr: Remove python-zephyr in favor of ctypes.
Our custom patched version of python-zephyr only worked on Python 2.
Now we don’t need python-zephyr at all.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-09-13 16:43:40 -07:00
Anders Kaseorg 56f805a5d7 zephyr_mirror_backend: Fix thread safety problems.
As of commit 5eaac7bfba (#18),
zulip.Client is not thread-safe and especially not fork-safe due to
connections held open by requests.Session.

Delay construction of the Client until after forking off
zulip_to_zephyr.  Replace the fork for each message sent by
zephyr_to_zulip with a threaded queue worker.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-09-13 16:43:40 -07:00
Robert Imschweiler 63c259b2bc integrations: Enhanced matrix bridge. 2022-09-08 16:14:23 -07:00
Anders Kaseorg 091511b164 Revert "integrations: Enhanced matrix bridge."
This reverts commit 72ef52d12e (#723).

The test failure on Windows will need to be debugged before this can
be re-merged.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-22 21:13:10 -07:00
Robert Imschweiler 72ef52d12e integrations: Enhanced matrix bridge. 2022-08-18 14:21:17 -07:00
rht b290717bb2 Matrix bridge: Print reminder to subscribe the bots on startup. 2022-07-27 16:23:49 -07:00
rht 31365a8aac bridge_with_matrix: Bump matrix-client 0.2.0 -> 0.4.0. 2022-05-24 14:49:04 -07:00
Anders Kaseorg d26416a1e7 Release version 0.8.2.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-15 17:44:12 -07:00
Eeshan Garg e6dff1b5b6 zulip: Fix deprecation warnings for SafeConfigParser and readfp.
SafeConfigParser has been renamed to ConfigParser and the method
SafeConfigParser.readfp() is now named ConfigParser.read_file().
2022-02-28 11:10:53 -08:00
Eeshan Garg 7c3967f777 zulip: Reraise exceptions in do_api_query.
There are cases where the call to an endpoint may result in an
exception the traceback for which is converted into JSON and
returned to the caller. In the case of such an unsuccessful
response, we should just reraise the exception instead of parsing
the response as though it was successful.
2022-02-28 11:10:53 -08:00
Anders Kaseorg 05d591a906 Remove legacy distutils support.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-28 10:35:58 -08:00
neiljp (Neil Pilgrim) 095d5d8f4e api: Fix missing parenthesis in comment for ModifiableMessageFlag. 2022-02-23 16:50:03 -08:00
neiljp (Neil Pilgrim) ea89e95857 api: Add Literal types for various important message flags.
With some copy-editing by tabbott.
2022-02-23 10:34:12 -08:00
Anders Kaseorg 68128640bf zulip: Fix principals default for remove_subscriptions.
The documented API for DELETE /api/v1/users/me/subscriptions is that
principals should be omitted to remove a subscription for the calling
user.  A call with principals=[] should have a different meaning, but
a server bug currently conflates this with a call omitting principals.
Avoid relying on this bug.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-18 17:01:18 -08:00
rht 56f5ee3d70 Matrix bridge: Say that the user may have to wait 1 minute. 2021-11-08 21:01:09 -08:00
rht c41ead698f Matrix bridge: Rename username to mxid.
The username doesn't include the Matrix homeserver domain name, while
the mxid does. Since we change the usage of the old "username" to
include the domain, it is incorrect to remain saying it as "username."
2021-11-08 21:01:09 -08:00
rht 59fd4f070a Matrix bridge: Remove hardcoded matrix.org from username.
This allows people to mirror from self-hosted Matrix instances.
2021-11-08 21:01:09 -08:00
Eeshan Garg bdc4901f07 pypi: Include py.typed in MANIFEST.in.
According to the `setuptools` docs, once `include_package_data=True`
is passed to `setup()`, it will only include package data specified
in `MANIFEST.in`, and will ignore the `package_data` argument passed
to `setup()`. Therefore, `py.typed` was not included in our latest
PyPI release 0.8.1.

Since we specify all of our package data in the `MANIFEST.in` file
already, it makes more sense to include mention `py.typed` there so
that it is included in the expected fashion.

See https://github.com/pypa/setuptools/issues/1461 for background.

Fixes #732.
2021-10-27 11:14:48 -07:00
rht 58e51c7ae5 Slack bridge: Bump slack-sdk to 3.11.2.
We also upgrade the RTM client API from v1 to v2. This is so that we no
longer require aiohttp. If we use v1, it would still require aiohttp.
2021-10-19 16:26:40 -07:00
Eeshan Garg fec8cc50c4 pypi: Release version 0.8.1. 2021-10-19 18:03:52 -04:00
PIG208 c59b143d96 api: Make update_user_by_id compatible.
As part of supporting the change in zulip/zulip#18409, we add a
conditional to send the old/buggy format only to servers with feature
levels indicating they don't support the modern version.
2021-10-17 21:41:28 -07:00
Anders Kaseorg 4787834d75 bridge_with_matrix: Fix test.
It was broken by commit e876a0541e
(#701).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-10-14 13:56:37 -07:00
rht e876a0541e
Matrix bridge: Fix username typo.
The sample username didn't quite match the format of actual Matrix usernames.
2021-10-14 12:26:47 -07:00
PIG208 d0edb0952e api: Replace function signatures for legacy zulip server.
To make sure that the API bindings is backward compatible with
older versions of zulip server that uses functions with different
signatures, we use a hack to replace the Client class with a
legacy-compatible version of it.
2021-10-13 09:26:56 -07:00
PIG208 05b9850ba3 api: Fetch server_settings when initializing Client.
We store the information about the version of the server and the feature
level for transparent compatibility handling.
2021-10-13 09:26:56 -07:00
rht 4e5e7b3d0f Slack bridge: Clarify config placeholder content. 2021-10-07 14:10:40 -07:00
rht 1ca696e75b Slack bridge: Explicitly require aiohttp.
It is required by the Slack library, but strangely not installed. So we
explicitly specify it.
2021-09-17 17:04:10 -07:00
Anders Kaseorg bdc139e9ed zulip_git_config: Add old default branch name for compatibility.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-31 15:04:35 -07:00
Anders Kaseorg 5da0857d51 zephyr_mirror_backend: Add missing parens for calling lower().
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-28 08:32:07 -07:00
Anders Kaseorg ffb8a38f26 test_default_arguments: Adjust for Python 3.10.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-26 16:54:59 -07:00
Anders Kaseorg 34f5c4ef02 git: Fix git_repository_name.
Without universal_newlines=True or text=True, subprocess.check_output
returns bytes, not str, so it makes no sense to compare its return to
"true".  But upstream Git’s behavior only depends on the filename, not
whether the repository is bare; emulate this more closely.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 21:01:05 -07:00
Anders Kaseorg d32d442c44 Upgrade mypy to 0.910.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 20:19:05 -07:00
Anders Kaseorg 626359596e Replace typing.Text with str.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 20:07:35 -07:00
Anders Kaseorg cb00a29311 test_matrix: Run Python subprocess via sys.executable.
This works better with pytest on Windows.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 16:51:23 -07:00
Anders Kaseorg 53e59c8c09 Rename default branch to ‘main’
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 12:50:52 -07:00
rht c602121171 slack bridge: Update doc for current version of making Slack bot user. 2021-07-06 16:21:41 -07:00
PIG208 df60a1ac03 matrix: Fix test failure brought by the hint for usernames change.
Fixes a188a4e72a.
2021-06-28 11:35:54 -02:30
Tim Abbott a188a4e72a matrix: Better hint the format for Matrix usernames. 2021-06-17 14:04:38 -07:00
PIG208 9ce7c52a10 pyupgrade: Reformat with --py36-plus.
This includes mainly fixes of string literals using f-strings or
.format(...), as well as unpacking of list comprehensions.
2021-06-02 18:45:57 -07:00
PIG208 e27ac0ddbe pyupgrade: Replace Text with str.
We uses `pyupgrade --py3-plus` to automatically replace all occurence
of `Text`. But manual fix is required to remove the unused imports. Note
that with this configuration pyupgrade also convert string literals to
.format(...) style, which is manually not included in the commit as well.
2021-06-02 18:45:57 -07:00
PIG208 6f3f9bf7e4 black: Reformat without skipping string normalization. 2021-06-02 18:45:57 -07:00
PIG208 fba21bb00d black: Reformat skipping string normalization. 2021-06-02 18:45:57 -07:00
PIG208 5580c68ae5 isort: Reformat using isort. 2021-06-02 18:45:57 -07:00
rht 5f21952b77 Add click as req in setup.py for zulip-cli. 2021-05-27 23:51:32 -07:00
rht 06bbfd752e Initialize CLI interface for python-zulip-api. 2021-05-24 14:35:02 -07:00
rht 05eaaff802 slack-bridge: Order imports properly. 2021-05-24 14:17:38 -07:00
rht 5b2da94ba5 slack-bridge: Use threading instead of multiprocessing.
This will fix the bug reported in
https://chat.zulip.org/#narrow/stream/127-integrations/topic/bridge_with_slack/near/1182555,
which is specific to macOS.

The error message is
```
AttributeError: Can't pickle local object 'SlackBridge.zulip_to_slack.<locals>._zulip_to_slack'
```
2021-05-24 14:17:38 -07:00
rht 2d9cf64db8 slack-bridge: Use slack_sdk instead of the deprecated slackclient. 2021-05-24 14:17:38 -07:00