Projet

Général

Profil

0001-do-not-rely-on-pkg_resources-46476.patch

Emmanuel Cazenave, 08 septembre 2020 17:15

Télécharger (3,33 ko)

Voir les différences:

Subject: [PATCH] do not rely on pkg_resources (#46476)

 README                                 |  7 ++++++
 setup.py                               |  5 -----
 src/authentic2_auth_fedict/__init__.py | 31 ++++++++++++++++----------
 3 files changed, 26 insertions(+), 17 deletions(-)
README
20 20
And appropriate django-mellon parameters (MELLON_PUBLIC_KEYS,
21 21
MELLON_PRIVATE_KEY, MELLON_IDENTITY_PROVIDERS).
22 22

  
23
You also have to register the plugin :
24

  
25
  import authentic2_auth_fedict
26

  
27
  INSTALLED_APPS, AUTHENTICATION_BACKENDS, AUTH_FRONTENDS = authentic2_auth_fedict.register(
28
      INSTALLED_APPS, AUTHENTICATION_BACKENDS, AUTH_FRONTENDS
29
  )
23 30

  
24 31
License
25 32
-------
setup.py
96 96
        install_requires=[
97 97
            'authentic2',
98 98
        ],
99
        entry_points={
100
            'authentic2.plugin': [
101
                'authentic2-auth-fedict = authentic2_auth_fedict:Plugin',
102
            ],
103
        },
104 99
        cmdclass={
105 100
            'build': build,
106 101
            'install_lib': install_lib,
src/authentic2_auth_fedict/__init__.py
28 28
        from . import signals
29 29
        user_logged_in.connect(signals.on_user_logged_in)
30 30

  
31
    def get_a2_plugin(self):
32
        return Plugin()
33

  
34

  
31 35
default_app_config = 'authentic2_auth_fedict.AppConfig'
32 36

  
33 37

  
......
36 40
        from . import urls
37 41
        return urls.urlpatterns
38 42

  
39
    def get_apps(self):
40
        return ['mellon', __name__]
41

  
42
    def get_authentication_backends(self):
43
        return ['authentic2_auth_fedict.backends.FedictBackend']
44

  
45
    def get_auth_frontends(self):
46
        return ['authentic2_auth_fedict.authenticators.FedictAuthenticator']
47

  
48
    def get_authenticators(self):
49
        return ['authentic2_auth_fedict.authenticators.FedictAuthenticator']
50

  
51 43
    def redirect_logout_list(self, request, next_url=None):
52 44
        from mellon.views import logout
53 45
        if 'mellon_session' in request.session:
......
102 94
             'name': 'country',
103 95
             'field_class': fields.CountryField, },
104 96
        ]
97

  
98

  
99
def register(installed_apps, authentication_backends, auth_frontends):
100
    apps = []
101
    for app in ('mellon', 'authentic2_auth_fedict'):
102
        if app not in installed_apps:
103
            apps.append(app)
104
    if apps:
105
        installed_apps += tuple(apps)
106
    if 'authentic2_auth_fedict.backends.FedictBackend' not in authentication_backends:
107
        authentication_backends += ('authentic2_auth_fedict.backends.FedictBackend',)
108
    if 'authentic2_auth_fedict.authenticators.FedictAuthenticator' not in auth_frontends:
109
        auth_frontends += ('authentic2_auth_fedict.authenticators.FedictAuthenticator',)
110

  
111
    return installed_apps, authentication_backends, auth_frontends
105
-