From 7d4e2f4edd81f9dda3858bf1802f2602d00a4b68 Mon Sep 17 00:00:00 2001 From: Charles Leifer Date: Mon, 21 Dec 2020 04:39:00 -0600 Subject: [PATCH] Fixes based on comments regarding building on windows. Specifically, python 3.9 and newer does not consume quotes on the command line, so additional escaping is not needed. Secondly, openssl lib name may be libcrypto.lib on newer openssl versions, so I've added an option to specify this with an environment variable OPENSSL_LIBNAME (which defaults to libeay32.lib for now). --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 2e1817c..a0ccf02 100644 --- a/setup.py +++ b/setup.py @@ -32,8 +32,8 @@ if sys.platform == "darwin": def quote_argument(arg): - quote = '"' if sys.platform != 'win32' else '\\"' - return quote + arg + quote + q = '\\"' if sys.platform == 'win32' and sys.version_info < (3, 9) else '"' + return q + arg + q define_macros = [('MODULE_NAME', quote_argument(PACKAGE_NAME + '.dbapi2'))] @@ -129,7 +129,8 @@ class AmalgationLibSqliteBuilder(build_ext): ext.define_macros.append(("inline", "__inline")) # Configure the linker - ext.extra_link_args.append("libeay32.lib") + openssl_libname = os.environ.get('OPENSSL_LIBNAME') or 'libeay32.lib' + ext.extra_link_args.append(openssl_libname) ext.extra_link_args.append('/LIBPATH:' + openssl_lib_path) build_ext.build_extension(self, ext)