Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mjolnir imports private Synapse function synapse.util.glob_to_regex, which has moved as of (unreleased) v1.50.0rc1 #173

Closed
reivilibre opened this issue Jan 5, 2022 · 0 comments

Comments

@reivilibre
Copy link
Contributor

Describe the bug
Mjolnir imports synapse.util.glob_to_regex which has moved in Synapse v1.50.0rc1 (matrix-org/synapse#11687) to matrix-common (https://github.com/matrix-org/matrix-python-common/).

To Reproduce
Steps to reproduce the behavior:

  1. Install v1.50.0rc1 (not yet released) or current Synapse develop branch with Mjolnir
  2. Start Synapse
  3. Synapse does not start; logs below generated

Additional context

  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/synapse/src/synapse/app/generic_worker.py", line 514, in <module>
    main()
  File "/home/synapse/src/synapse/app/generic_worker.py", line 510, in main
    start(sys.argv[1:])
  File "/home/synapse/src/synapse/app/generic_worker.py", line 424, in start
    config = HomeServerConfig.load_config("Synapse worker", config_options)
  File "/home/synapse/src/synapse/config/_base.py", line 461, in load_config
    obj, _ = cls.load_config_with_parser(config_parser, argv)
  File "/home/synapse/src/synapse/config/_base.py", line 533, in load_config_with_parser
    config_dict, config_dir_path=config_dir_path, data_dir_path=data_dir_path
  File "/home/synapse/src/synapse/config/_base.py", line 725, in parse_config_dict
    data_dir_path=data_dir_path,
  File "/home/synapse/src/synapse/config/_base.py", line 347, in invoke_all
    res[config_class.section] = getattr(config, func_name)(*args, **kwargs)
  File "/home/synapse/src/synapse/config/spam_checker.py", line 52, in read_config
    self.spam_checkers.append(load_module(spam_checker, config_path))
  File "/home/synapse/src/synapse/util/module_loader.py", line 49, in load_module
    module = importlib.import_module(module_name)
  File "/home/synapse/env-py37/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/synapse/env-py37/lib/python3.7/site-packages/mjolnir/__init__.py", line 1, in <module>
    from .antispam import AntiSpam
  File "/home/synapse/env-py37/lib/python3.7/site-packages/mjolnir/antispam.py", line 17, in <module>
    from .list_rule import ALL_RULE_TYPES, RECOMMENDATION_BAN
  File "/home/synapse/env-py37/lib/python3.7/site-packages/mjolnir/list_rule.py", line 16, in <module>
    from synapse.util import glob_to_regex
ImportError: cannot import name 'glob_to_regex' from 'synapse.util' (/home/synapse/src/synapse/util/__init__.py)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant