From 68af5b2f807ac8acd9525d46d37cfd2a28a06b47 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 16 Jan 2013 23:33:46 +0900 Subject: fix ctypes dependency discovery for libgnutls --- pkg/osx/install/install-leapc.sh | 8 -------- pkg/osx/leap-client.spec | 3 --- src/leap/crypto/__init__.py | 26 ++++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/pkg/osx/install/install-leapc.sh b/pkg/osx/install/install-leapc.sh index a2435adf..2ecfc08e 100755 --- a/pkg/osx/install/install-leapc.sh +++ b/pkg/osx/install/install-leapc.sh @@ -5,14 +5,6 @@ cp -r "LEAP Client.app" "/Applications" echo "Copying openvpn binary" cp -r openvpn.leap /usr/bin -echo "Installing gnutls" -mkdir -p /opt/local/lib -mv -f "/Applications/LEAP Client.app/Contents/MacOS/libgnutls.26.dylib" /opt/local/lib -mv -f "/Applications/LEAP Client.app/Contents/MacOS/libgnutls-extra.26.dylib" /opt/local/lib -ln -sf /opt/local/lib/libgnutls.26.dylib /opt/local/lib/libgnutls.dylib -ln -sf /opt/local/lib/libgnutls-extra.26.dylib /opt/local/lib/libgnutls-extra.dylib - - echo "Installing tun/tap drivers" cp -r Extensions/* /Library/Extensions cp -r StartupItems/* /Library/StartupItems diff --git a/pkg/osx/leap-client.spec b/pkg/osx/leap-client.spec index 65496469..75bf991b 100644 --- a/pkg/osx/leap-client.spec +++ b/pkg/osx/leap-client.spec @@ -19,9 +19,6 @@ coll = COLLECT(exe, # this will easitly break if we setup the venv # somewhere else. FIXME [('cacert.pem', '../../../../lib/python2.6/site-packages/requests/cacert.pem', 'DATA'), - # XXX osx only - ('libgnutls.26.dylib', '/opt/local/lib/libgnutls.26.dylib', 'BINARY'), - ('libgnutls-extra.26.dylib', '/opt/local/lib/libgnutls-extra.26.dylib', 'BINARY'), ], a.zipfiles, a.datas, diff --git a/src/leap/crypto/__init__.py b/src/leap/crypto/__init__.py index e69de29b..8df3fc6c 100644 --- a/src/leap/crypto/__init__.py +++ b/src/leap/crypto/__init__.py @@ -0,0 +1,26 @@ +""" +DEBUG! ----------- gnutls lib: libgnutls.26.dylib +DEBUG! ----------- gnutls lib: /usr/local/lib/libgnutls.26.dylib +DEBUG! ----------- gnutls lib: /opt/local/lib/libgnutls.26.dylib +DEBUG! ----------- gnutls lib: libgnutls-extra.26.dylib +DEBUG! ----------- gnutls lib: /usr/local/lib/libgnutls-extra.26.dylib +DEBUG! ----------- gnutls lib: /opt/local/lib/libgnutls-extra.26.dylib +""" +import sys + +# hackaround pyinstaller ctypes dependencies discovery +# See: +# http://www.pyinstaller.org/wiki/Features/CtypesDependencySupport#SolutioninPyInstaller +# gnutls.library.load_library is using a style of dep loading +# unsupported by pyinstaller. So we force these imports here. + +if sys.platform == "darwin": + from ctypes import CDLL + try: + CDLL("libgnutls.26.dylib") + except OSError: + pass + try: + CDLL("libgnutls-extra.26.dylib") + except OSError: + pass -- cgit v1.2.3