From cfb6afc25544b2acd3f488c2914634d7d361acfa Mon Sep 17 00:00:00 2001 From: Henrik Blidh Date: Fri, 17 Nov 2017 07:56:47 +0100 Subject: [PATCH] Version 0.6.1 Fix for #10. Also updates to test on PyPy as well. Updating install_requires in setup.py --- .travis.yml | 2 ++ bankid/certutils.py | 47 ++++++++++++++++++++++----------------------- bankid/version.py | 2 +- setup.py | 8 +++++++- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2532eda..2eda498 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,12 @@ python: - 3.5 - 3.6 - "nightly" + - "pypy" - "pypy3" matrix: allow_failures: - python: "nightly" + - python: "pypy" - python: "pypy3" branches: only: diff --git a/bankid/certutils.py b/bankid/certutils.py index ddaa5cf..74128e3 100644 --- a/bankid/certutils.py +++ b/bankid/certutils.py @@ -20,6 +20,8 @@ import subprocess import requests +from bankid.exceptions import BankIDError + _TEST_CERT_PASSWORD = 'qwerty123' _TEST_CERT_URL = "https://www.bankid.com/assets/bankid/rp/FPTestcert2_20150818_102329.pfx" @@ -69,34 +71,31 @@ def split_certificate(certificate_path, destination_folder, password=None): :rtype: tuple """ - try: # pragma: no cover - # Attempt Linux call first + try: + # Attempt Linux and Darwin call first. p = subprocess.Popen(['openssl', 'version'], stdout=subprocess.PIPE) sout, serr = p.communicate() - if not sout.decode().lower().startswith('openssl'): - raise NotImplementedError( - "OpenSSL executable could not be found. " - "Splitting cannot be performed.") + openssl_executable_version = sout.decode().lower() + if not (openssl_executable_version.startswith('openssl') or + openssl_executable_version.startswith('libressl')): + raise BankIDError("OpenSSL executable could not be found. " + "Splitting cannot be performed.") print(sout.strip()) openssl_executable = 'openssl' - except: # pragma: no cover - try: # pragma: no cover - # Attempt to call on standard Git for Windows path. - p = subprocess.Popen(['C:\\Program Files\\Git\\mingw64\\bin\\openssl.exe', 'version'], - stdout=subprocess.PIPE) - sout, serr = p.communicate() - if not sout.decode().lower().startswith('openssl'): - raise NotImplementedError( - "OpenSSL executable could not be found. " - "Splitting cannot be performed.") - print(sout.strip()) - openssl_executable = 'C:\\Program Files\\Git\\mingw64\\bin\\openssl.exe' - except: # pragma: no cover - raise NotImplementedError( - "OpenSSL executable could not be found. " - "Splitting cannot be performed.") - - if not os.path.exists(os.path.abspath(os.path.expanduser(destination_folder))): # pragma: no cover + except BankIDError: + # Attempt to call on standard Git for Windows path. + p = subprocess.Popen( + ['C:\\Program Files\\Git\\mingw64\\bin\\openssl.exe', 'version'], + stdout=subprocess.PIPE) + sout, serr = p.communicate() + if not sout.decode().lower().startswith('openssl'): + raise BankIDError("OpenSSL executable could not be found. " + "Splitting cannot be performed.") + print(sout.strip()) + openssl_executable = 'C:\\Program Files\\Git\\mingw64\\bin\\openssl.exe' + + if not os.path.exists(os.path.abspath( + os.path.expanduser(destination_folder))): os.makedirs(os.path.abspath(os.path.expanduser(destination_folder))) # Paths to output files. diff --git a/bankid/version.py b/bankid/version.py index 960dab9..0bc19ef 100644 --- a/bankid/version.py +++ b/bankid/version.py @@ -12,5 +12,5 @@ from __future__ import print_function from __future__ import absolute_import -__version__ = '0.6.0' +__version__ = '0.6.1' version = __version__ # backwards compatibility name diff --git a/setup.py b/setup.py index 50c4dc1..4c2bf28 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,12 @@ def read(f): return open(f, encoding='utf-8').read() +REQUIRES = [ + "requests", + "zeep", + "six" +] + setup( name='pybankid', version=version, @@ -64,7 +70,7 @@ def read(f): platforms=['any'], packages=find_packages(exclude=('tests', )), package_data={'': ['*.pem']}, - install_requires=read('requirements.txt').strip().splitlines(), + install_requires=REQUIRES, dependency_links=[], ext_modules=[], extras_require={