diff options
author | Ismaël Bouya | 2018-08-08 09:23:12 +0200 |
---|---|---|
committer | Ismaël Bouya | 2018-08-08 09:23:42 +0200 |
commit | 455bb101c8fdacdf463f2114958491de11d1cbd1 (patch) | |
tree | 6b804e9da6aec65bf1512c979e55b13f2eb81650 | |
parent | 6b22a9010c249884b5efbfeb03b6b3e69ce6ffb3 (diff) | |
download | aur-455bb101c8fdacdf463f2114958491de11d1cbd1.tar.gz |
Revert undue "Fix build for python3.6"
This reverts commit 5590d09e5f532c070fed25a9c0ac6f175a163aa7.
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 15 | ||||
-rw-r--r-- | ldap_fix.py | 93 |
3 files changed, 7 insertions, 107 deletions
@@ -1,9 +1,9 @@ # Generated by mksrcinfo v8 -# Wed Aug 8 07:12:40 UTC 2018 +# Wed Aug 8 07:23:36 UTC 2018 pkgbase = mediagoblin-git pkgdesc = A free software media publishing platform pkgver = 0.9.0.r16.gcd465ebf - pkgrel = 1 + pkgrel = 2 url = http://mediagoblin.org install = mediagoblin.install arch = i686 @@ -37,14 +37,12 @@ pkgbase = mediagoblin-git source = paste_local.ini source = mediagoblin_local.ini source = mediagoblin-tmpfiles.conf - source = ldap_fix.py sha256sums = SKIP sha256sums = 2a02c90dcc8f69ac2a072044d3e4281347ed048c2610cb2e11295e4876cfb409 sha256sums = f636d02f86d2dab5ecc901be5b0f7c42366500393f22dfdc7e354ca299fca65a sha256sums = ac914d60886d9bf53d3f40b8b00a60d46ada1cac9130210e045a4776d898e884 sha256sums = 9adf338f5dbfb94ee7ae29433091b6991a1fa39a6135a8295f9f1cc1fde0edc1 sha256sums = abb6c4c4e54d4372adfe67ab22371ad625505098311955e5ae8e34102b059d47 - sha256sums = a57ce62645cdcc6dc752d5af18350be492df02128e54deac088f4d77874f91e9 pkgname = mediagoblin-git @@ -2,7 +2,7 @@ pkgname=mediagoblin-git pkgver=0.9.0.r16.gcd465ebf -pkgrel=1 +pkgrel=2 pkgdesc='A free software media publishing platform' arch=('i686' 'x86_64') url='http://mediagoblin.org' @@ -30,15 +30,13 @@ source=( 'paste_local.ini' 'mediagoblin_local.ini' 'mediagoblin-tmpfiles.conf' - 'ldap_fix.py' ) sha256sums=('SKIP' '2a02c90dcc8f69ac2a072044d3e4281347ed048c2610cb2e11295e4876cfb409' 'f636d02f86d2dab5ecc901be5b0f7c42366500393f22dfdc7e354ca299fca65a' 'ac914d60886d9bf53d3f40b8b00a60d46ada1cac9130210e045a4776d898e884' '9adf338f5dbfb94ee7ae29433091b6991a1fa39a6135a8295f9f1cc1fde0edc1' - 'abb6c4c4e54d4372adfe67ab22371ad625505098311955e5ae8e34102b059d47' - 'a57ce62645cdcc6dc752d5af18350be492df02128e54deac088f4d77874f91e9') + 'abb6c4c4e54d4372adfe67ab22371ad625505098311955e5ae8e34102b059d47') pkgver() { cd "$srcdir/mediagoblin" @@ -56,24 +54,21 @@ build() { ./bootstrap.sh ./configure --with-python3 - make - ./bin/easy_install flup typing - sed -i "s/registry.has_key(current_theme_name)/current_theme_name in registry/" mediagoblin/tools/theme.py + make || make + ./bin/easy_install flup } package() { cd "$srcdir/mediagoblin" + rm -rf .git .gitignore install -dm755 "$pkgdir"/usr/share/webapps/mediagoblin/ cp -a . "$pkgdir"/usr/share/webapps/mediagoblin cd "$pkgdir"/usr/share/webapps/mediagoblin - - rm -rf .git .gitignore find . -name '*.pyc' -delete find . -type f -exec sed -i "s|$srcdir/mediagoblin|/usr/share/webapps/mediagoblin|g" {} \; - install -Dm644 "$srcdir/ldap_fix.py" "$pkgdir"/usr/share/webapps/mediagoblin/mediagoblin/plugins/ldap/tools.py install -dm755 "$pkgdir"/var/lib/mediagoblin install -dm755 "$pkgdir"/etc/webapps/mediagoblin diff --git a/ldap_fix.py b/ldap_fix.py deleted file mode 100644 index 10cc375cf31a..000000000000 --- a/ldap_fix.py +++ /dev/null @@ -1,93 +0,0 @@ -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -from ldap3 import Server, Connection, SUBTREE -from ldap3.core.exceptions import LDAPException -import logging - -import six - -from mediagoblin.tools import pluginapi - -_log = logging.getLogger(__name__) - - -class LDAP(object): - def __init__(self): - self.ldap_settings = pluginapi.get_config('mediagoblin.plugins.ldap') - - def _connect(self, server): - _log.info('Connecting to {0}.'.format(server['LDAP_SERVER_URI'])) - self.server = Server(server['LDAP_SERVER_URI']) - - if 'LDAP_START_TLS' in server and server['LDAP_START_TLS'] == 'true': - _log.info('Initiating TLS') - self.server.start_tls() - - def _manager_auth(self, settings, username, password): - conn = Connection(self.server, - settings['LDAP_BIND_DN'], - settings['LDAP_BIND_PW'], - auto_bind=True) - found = conn.search( - search_base=settings['LDAP_SEARCH_BASE'], - search_filter=settings['LDAP_SEARCH_FILTER'].format(username=username), - search_scope=SUBTREE, - attributes=[settings['EMAIL_SEARCH_FIELD']]) - if (not found) or len(conn.entries) > 1: - return False, None - - user = conn.entries[0] - user_dn = user.entry_dn - try: - email = user.entry_attributes_as_dict[settings['EMAIL_SEARCH_FIELD']][0] - except KeyError: - email = None - - Connection(self.server, user_dn, password, auto_bind=True) - - return username, email - - def _direct_auth(self, settings, username, password): - user_dn = settings['LDAP_USER_DN_TEMPLATE'].format(username=username) - conn = Connection(self.server, user_dn, password, auto_bind=True) - email_found = conn.search( - search_base=settings['LDAP_SEARCH_BASE'], - search_filter='uid={0}'.format(username), - search_scope=SUBTREE, - attributes=[settings['EMAIL_SEARCH_FIELD']]) - - if email_found: - try: - email = conn.entries[0].entry_attributes_as_dict[settings['EMAIL_SEARCH_FIELD']][0] - except KeyError: - email = None - - return username, email - - def login(self, username, password): - for k, v in six.iteritems(self.ldap_settings): - try: - self._connect(v) - - if 'LDAP_BIND_DN' in v: - return self._manager_auth(v, username, password) - else: - return self._direct_auth(v, username, password) - - except LDAPException as e: - _log.info(e) - - return False, None |