certat / do-portal

This project is in maintenance mode and will only receive bug fixes, but no new features. A new version of this software is being developed.
5 stars 5 forks source link

Incompatibility with Python >= 3.7 #121

Open ghost opened 4 years ago

ghost commented 4 years ago

It is not possible to run do-portal with any Python version >= 3.7 as "async" is a keyword.

(do-portal) sebastianw@medan backend (master *%)$ python manage.py db init
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    from app import create_app
  File "/home/sebastianw/dev/do-portal/backend/app/__init__.py", line 6, in <module>
    from flask_ldap3_login import LDAP3LoginManager
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/flask_ldap3_login/__init__.py", line 3, in <module>
    import ldap3
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/ldap3/__init__.py", line 408, in <module>
    from .core.connection import Connection
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/ldap3/core/connection.py", line 53
    from ..strategy.async import AsyncStrategy
                    ^
SyntaxError: invalid syntax

See also https://github.com/cannatag/ldap3/issues/428

As we AFAIK do not actually use LDAP, this could be easy to fix.

Another similar error is (above state + applying some workarounds):

(do-portal) sebastianw@medan backend (master *%)$ python manage.py db init
Traceback (most recent call last):
  File "manage.py", line 276, in <module>
    cli()
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/flask/cli.py", line 374, in main
    return AppGroup.main(self, *args, **kwargs)
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/flask/cli.py", line 250, in decorator
    with __ctx.ensure_object(ScriptInfo).load_app().app_context():
  File "/home/sebastianw/.venvs/do-portal/lib64/python3.8/site-packages/flask/cli.py", line 223, in load_app
    rv = self.create_app(self)
  File "manage.py", line 22, in create_cli_app
    return create_app(os.getenv('DO_CONFIG') or 'default')
  File "/home/sebastianw/dev/do-portal/backend/app/__init__.py", line 91, in create_app
    init_routes(app)
  File "/home/sebastianw/dev/do-portal/backend/app/__init__.py", line 118, in init_routes
    from .auth import auth as auth_blueprint
  File "/home/sebastianw/dev/do-portal/backend/app/auth/__init__.py", line 10, in <module>
    from ..api.decorators import json_response, rate_limit, crossdomain
  File "/home/sebastianw/dev/do-portal/backend/app/api/__init__.py", line 11, in <module>
    from . import organizations, organization_groups, ip_ranges, lists  # noqa
  File "/home/sebastianw/dev/do-portal/backend/app/api/lists.py", line 11, in <module>
    from .emails import send_email
  File "/home/sebastianw/dev/do-portal/backend/app/api/emails.py", line 8, in <module>
    from .decorators import json_response
  File "/home/sebastianw/dev/do-portal/backend/app/api/decorators.py", line 115
    def async(f):
        ^
SyntaxError: invalid syntax
MarkHofstetter commented 4 years ago

I am fully aware of this and there is no simple remedy (just like renaming the method) so it has to wait for the "rewrite" when all is raised to new versions