From 4118fec5ceb4bda79b1c117c95b378551163ab8b Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 5 Dec 2013 11:32:46 -0400 Subject: remove the development flag so it's pip-installable --- setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index ebf535a..8ee9601 100644 --- a/setup.py +++ b/setup.py @@ -21,8 +21,6 @@ # 2. Altered source versions must be plainly marked as such, and must not be # misrepresented as being the original software. # 3. This notice may not be removed or altered from any source distribution. - -import glob import os import re import sys @@ -47,8 +45,8 @@ sqlite = "sqlite" PYSQLITE_EXPERIMENTAL = False -#DEV_VERSION = None -DEV_VERSION = "02" +DEV_VERSION = None +#DEV_VERSION = "02" sources = ["src/module.c", "src/connection.c", "src/cursor.c", "src/cache.c", "src/microprotocols.c", "src/prepare_protocol.c", "src/statement.c", -- cgit v1.2.3 From a181dc3bd83cee6ce1d8082f66d87b7e96b8a3bd Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 8 Sep 2014 19:13:09 -0500 Subject: set CFLAGS to -Qnoused-arguments to allow osx build --- setup.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 8ee9601..fe9a0a3 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,6 @@ import zipfile from types import ListType, TupleType from distutils.core import setup, Extension, Command -#from setuptools import setup, Extension, Command from distutils.command.build import build from distutils.command.build_ext import build_ext from distutils.dep_util import newer_group @@ -48,6 +47,8 @@ PYSQLITE_EXPERIMENTAL = False DEV_VERSION = None #DEV_VERSION = "02" +PATCH_VERSION = "1" + sources = ["src/module.c", "src/connection.c", "src/cursor.c", "src/cache.c", "src/microprotocols.c", "src/prepare_protocol.c", "src/statement.c", "src/util.c", "src/row.c"] @@ -55,6 +56,14 @@ sources = ["src/module.c", "src/connection.c", "src/cursor.c", "src/cache.c", if PYSQLITE_EXPERIMENTAL: sources.append("src/backup.c") + +if sys.platform == "darwin": + #from sysconfig import get_config_var + #cf = get_config_var('CFLAGS') + # Work around clang raising hard error for unused arguments + os.environ['CFLAGS'] = "-Qunused-arguments" + print "CFLAGS", os.environ['CFLAGS'] + include_dirs = [] library_dirs = [] libraries = [] @@ -297,17 +306,19 @@ def get_setup_args(): break f.close() - if DEV_VERSION: - PYSQLITE_VERSION += ".dev%s" % DEV_VERSION - if not PYSQLITE_VERSION: print "Fatal error: PYSQLITE_VERSION could not be detected!" sys.exit(1) + if DEV_VERSION: + PYSQLITE_VERSION += ".dev%s" % DEV_VERSION + + if PATCH_VERSION: + PYSQLITE_VERSION += "-%s" % PATCH_VERSION + setup_args = dict( name="pysqlcipher", version=PYSQLITE_VERSION, - #version="0.0.1", description="DB-API 2.0 interface for SQLCIPHER 3.x", long_description=long_description, author="Kali Kaneko", -- cgit v1.2.3 From 39e388a9f0fd10743c9bb1ab378d15f5c157265e Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 11 Sep 2014 21:59:02 -0500 Subject: move to setuptools based setup --- setup.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index fe9a0a3..548dcce 100644 --- a/setup.py +++ b/setup.py @@ -29,13 +29,15 @@ import zipfile from types import ListType, TupleType -from distutils.core import setup, Extension, Command from distutils.command.build import build from distutils.command.build_ext import build_ext from distutils.dep_util import newer_group from distutils.errors import DistutilsSetupError from distutils import log +import setuptools +from setuptools import Extension, Command + import cross_bdist_wininst # If you need to change anything, it should be enough to change setup.cfg. @@ -45,7 +47,6 @@ sqlite = "sqlite" PYSQLITE_EXPERIMENTAL = False DEV_VERSION = None -#DEV_VERSION = "02" PATCH_VERSION = "1" @@ -58,8 +59,6 @@ if PYSQLITE_EXPERIMENTAL: if sys.platform == "darwin": - #from sysconfig import get_config_var - #cf = get_config_var('CFLAGS') # Work around clang raising hard error for unused arguments os.environ['CFLAGS'] = "-Qunused-arguments" print "CFLAGS", os.environ['CFLAGS'] @@ -231,8 +230,6 @@ class MyBuildExt(build_ext): for undef in ext.undef_macros: macros.append((undef,)) - # XXX debug - #objects = [] objects = self.compiler.compile(sources, output_dir=self.build_temp, macros=macros, @@ -367,7 +364,7 @@ def get_setup_args(): def main(): - setup(**get_setup_args()) + setuptools.setup(**get_setup_args()) if __name__ == "__main__": main() -- cgit v1.2.3 From e91f1c8b61bab65d19a3169cb9c9d2d2fb84e232 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 10 Nov 2014 22:11:26 +0100 Subject: use https uri for amalgamation download Closes: #13 --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 548dcce..6f2f6cb 100644 --- a/setup.py +++ b/setup.py @@ -116,8 +116,7 @@ def get_amalgamation(): os.mkdir(AMALGAMATION_ROOT) print "Downloading amalgation." - # XXX upload the amalgamation file to downloads.leap.se - amalgamation_url = ("http://futeisha.org/sqlcipher/" + amalgamation_url = ("https://downloads.leap.se/libs/pysqlcipher" "amalgamation-sqlcipher-2.1.0.zip") # and download it -- cgit v1.2.3 From 18514b5e52d52e1fe87abd2830871e1f3e902f49 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 19 Oct 2014 18:03:31 +0300 Subject: Add support for msvc --- setup.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 6f2f6cb..a8a2531 100644 --- a/setup.py +++ b/setup.py @@ -180,7 +180,24 @@ class MyBuildExt(build_ext): ext.sources.append(os.path.join(AMALGAMATION_ROOT, "sqlite3.c")) ext.include_dirs.append(AMALGAMATION_ROOT) - ext.extra_link_args.append("-lcrypto") + if sys.platform == "win32": + # Try to locate openssl + openssl_conf = os.environ.get('OPENSSL_CONF') + if not openssl_conf: + sys.exit('Fatal error: OpenSSL could not be detected!') + openssl = os.path.dirname(os.path.dirname(openssl_conf)) + + # Configure the compiler + ext.include_dirs.append(os.path.join(openssl, "include")) + ext.define_macros.append(("inline", "__inline")) + + # Configure the linker + ext.extra_link_args.append("libeay32.lib") + ext.extra_link_args.append( + "/LIBPATH:" + os.path.join(openssl, "lib") + ) + else: + ext.extra_link_args.append("-lcrypto") if self.static: self._build_extension(ext) -- cgit v1.2.3 From 21b2f1767c8298128db0d4f05f77c3dfc0a7a633 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 11 Nov 2014 19:44:20 +0100 Subject: bump version in setup.py --- setup.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index a8a2531..377527b 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ PYSQLITE_EXPERIMENTAL = False DEV_VERSION = None -PATCH_VERSION = "1" +PATCH_VERSION = None sources = ["src/module.c", "src/connection.c", "src/cursor.c", "src/cache.c", "src/microprotocols.c", "src/prepare_protocol.c", "src/statement.c", @@ -184,7 +184,7 @@ class MyBuildExt(build_ext): # Try to locate openssl openssl_conf = os.environ.get('OPENSSL_CONF') if not openssl_conf: - sys.exit('Fatal error: OpenSSL could not be detected!') + sys.exit('Fatal error: OpenSSL could not be detected!') openssl = os.path.dirname(os.path.dirname(openssl_conf)) # Configure the compiler @@ -329,14 +329,19 @@ def get_setup_args(): if PATCH_VERSION: PYSQLITE_VERSION += "-%s" % PATCH_VERSION + # Need to bump minor version, patch handled badly. + PYSQLCIPHER_VERSION = "2.6.4" + setup_args = dict( name="pysqlcipher", - version=PYSQLITE_VERSION, + #version=PYSQLITE_VERSION, + version=PYSQLCIPHER_VERSION, description="DB-API 2.0 interface for SQLCIPHER 3.x", long_description=long_description, author="Kali Kaneko", - author_email="kali@futeisha.org", - license="zlib/libpng", # is THIS a license? + author_email="kali@leap.se", + license="zlib/libpng", + # XXX check # It says MIT in the google project platforms="ALL", url="http://github.com/leapcode/pysqlcipher/", -- cgit v1.2.3 From 83f36392e5086e5d40e4574b480ddaf6c10b6a64 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 12 Nov 2014 17:41:19 +0100 Subject: fix typo in almalgamation url --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 377527b..6db3492 100644 --- a/setup.py +++ b/setup.py @@ -116,7 +116,7 @@ def get_amalgamation(): os.mkdir(AMALGAMATION_ROOT) print "Downloading amalgation." - amalgamation_url = ("https://downloads.leap.se/libs/pysqlcipher" + amalgamation_url = ("https://downloads.leap.se/libs/pysqlcipher/" "amalgamation-sqlcipher-2.1.0.zip") # and download it -- cgit v1.2.3 From b841786c39c1b8fc0fbad7d2d94f318ca1831b7f Mon Sep 17 00:00:00 2001 From: PaixuAabuizia Date: Sun, 24 Jan 2016 14:36:33 +0100 Subject: [bug] setup does only work with msvc compiler add compiler detection for msvc & mingw32 --- setup.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 6db3492..80e5918 100644 --- a/setup.py +++ b/setup.py @@ -192,10 +192,13 @@ class MyBuildExt(build_ext): ext.define_macros.append(("inline", "__inline")) # Configure the linker - ext.extra_link_args.append("libeay32.lib") - ext.extra_link_args.append( - "/LIBPATH:" + os.path.join(openssl, "lib") - ) + if self.compiler.compiler_type == "msvc": + ext.extra_link_args.append("libeay32.lib") + ext.extra_link_args.append( + "/LIBPATH:" + os.path.join(openssl, "lib") + ) + if self.compiler.compiler_type == "mingw32": + ext.extra_link_args.append("-lcrypto") else: ext.extra_link_args.append("-lcrypto") -- cgit v1.2.3 From 80484cd8e32c9c4117860824e82baebf071492d2 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Tue, 12 Jul 2016 20:23:31 +0200 Subject: enable HAVE_USLEEP flag --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 80e5918..0293ff6 100644 --- a/setup.py +++ b/setup.py @@ -176,6 +176,8 @@ class MyBuildExt(build_ext): ("SQLITE_HAS_CODEC", "1")) ext.define_macros.append( ("SQLITE_TEMP_STORE", "2")) + ext.define_macros.append( + ("HAVE_USLEEP", "1")) ext.sources.append(os.path.join(AMALGAMATION_ROOT, "sqlite3.c")) ext.include_dirs.append(AMALGAMATION_ROOT) @@ -333,7 +335,7 @@ def get_setup_args(): PYSQLITE_VERSION += "-%s" % PATCH_VERSION # Need to bump minor version, patch handled badly. - PYSQLCIPHER_VERSION = "2.6.4" + PYSQLCIPHER_VERSION = "2.6.5" setup_args = dict( name="pysqlcipher", -- cgit v1.2.3 From 3fd5e3d5e9785a7e309c3021f174c3ff52bcc363 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Fri, 30 Sep 2016 15:44:33 -0400 Subject: [pkg] change the build behavior - link against system libsqlcipher by default - vendor amalgamation - control its build with --bundled flag - allow to pass amalgamation folder with --amalgamation= --- setup.py | 72 +++++++++++++++++++++++----------------------------------------- 1 file changed, 26 insertions(+), 46 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 0293ff6..1ad91b9 100644 --- a/setup.py +++ b/setup.py @@ -83,6 +83,18 @@ if sys.platform != "win32": else: define_macros.append(('MODULE_NAME', '\\"pysqlcipher.dbapi2\\"')) +BUNDLED = False +AMALGAMATION_ROOT = "amalgamation" + +for idx, arg in enumerate(list(sys.argv)): + if arg.startswith('--bundled'): + sys.argv.pop(idx) + BUNDLED = True + break + if arg.startswith('--amalgamation='): + AMALGAMATION_ROOT = arg.split("=",1)[1] + break + class DocBuilder(Command): description = "Builds the documentation" @@ -106,45 +118,6 @@ class DocBuilder(Command): print ("Is sphinx installed? If not, " "try 'sudo easy_install sphinx'.") -AMALGAMATION_ROOT = "amalgamation" - - -def get_amalgamation(): - """Download the SQLite amalgamation if it isn't there, already.""" - if os.path.exists(AMALGAMATION_ROOT): - return - os.mkdir(AMALGAMATION_ROOT) - print "Downloading amalgation." - - amalgamation_url = ("https://downloads.leap.se/libs/pysqlcipher/" - "amalgamation-sqlcipher-2.1.0.zip") - - # and download it - print 'amalgamation url: %s' % (amalgamation_url,) - urllib.urlretrieve(amalgamation_url, "tmp.zip") - - zf = zipfile.ZipFile("tmp.zip") - files = ["sqlite3.c", "sqlite3.h"] - directory = zf.namelist()[0] - - for fn in files: - print "Extracting", fn - outf = open(AMALGAMATION_ROOT + os.sep + fn, "wb") - outf.write(zf.read(directory + fn)) - outf.close() - zf.close() - os.unlink("tmp.zip") - - -class AmalgamationBuilder(build): - description = ("Build a statically built pysqlcipher " - "downloading and using a sqlcipher amalgamation.") - - def __init__(self, *args, **kwargs): - MyBuildExt.amalgamation = True - MyBuildExt.static = True - build.__init__(self, *args, **kwargs) - class LibSQLCipherBuilder(build_ext): @@ -156,16 +129,17 @@ class LibSQLCipherBuilder(build_ext): build_ext.build_extension(self, ext) -class MyBuildExt(build_ext): +class AmalgamationBuildExt(build_ext): amalgamation = True # We want amalgamation on the default build for now static = False def build_extension(self, ext): if self.amalgamation: - get_amalgamation() # build with fulltext search enabled ext.define_macros.append( ("SQLITE_ENABLE_FTS3", "1")) + ext.define_macros.append( + ("SQLITE_ENABLE_FTS5", "1")) ext.define_macros.append( ("SQLITE_ENABLE_RTREE", "1")) @@ -335,7 +309,7 @@ def get_setup_args(): PYSQLITE_VERSION += "-%s" % PATCH_VERSION # Need to bump minor version, patch handled badly. - PYSQLCIPHER_VERSION = "2.6.5" + PYSQLCIPHER_VERSION = "2.6.6" setup_args = dict( name="pysqlcipher", @@ -380,12 +354,18 @@ def get_setup_args(): cmdclass={"build_docs": DocBuilder} ) - setup_args["cmdclass"].update( + + if BUNDLED: + build_ext = AmalgamationBuildExt + else: + build_ext = LibSQLCipherBuilder + + setup_args['cmdclass'].update({'build_ext': build_ext}) + + setup_args['cmdclass'].update( {"build_docs": DocBuilder, - "build_ext": MyBuildExt, - "build_static": AmalgamationBuilder, - "build_sqlcipher": LibSQLCipherBuilder, "cross_bdist_wininst": cross_bdist_wininst.bdist_wininst}) + return setup_args -- cgit v1.2.3 From 7d2faa4d5df2468d14c8bc8b9b0876824e1a2ac0 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Mon, 3 Oct 2016 15:55:42 -0400 Subject: update to 2.6.7 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 1ad91b9..b1b38a0 100644 --- a/setup.py +++ b/setup.py @@ -309,7 +309,7 @@ def get_setup_args(): PYSQLITE_VERSION += "-%s" % PATCH_VERSION # Need to bump minor version, patch handled badly. - PYSQLCIPHER_VERSION = "2.6.6" + PYSQLCIPHER_VERSION = "2.6.7" setup_args = dict( name="pysqlcipher", -- cgit v1.2.3 From ebdd8f6647495b594bd7b79b3d3396e26047b277 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Mon, 23 Jan 2017 18:34:52 +0100 Subject: bump version for pysqlcipher 2.6.8 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index b1b38a0..86c43b4 100644 --- a/setup.py +++ b/setup.py @@ -309,7 +309,7 @@ def get_setup_args(): PYSQLITE_VERSION += "-%s" % PATCH_VERSION # Need to bump minor version, patch handled badly. - PYSQLCIPHER_VERSION = "2.6.7" + PYSQLCIPHER_VERSION = "2.6.8" setup_args = dict( name="pysqlcipher", -- cgit v1.2.3 From bb9cc1216873604459724860d606283c398ea06b Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Thu, 2 Feb 2017 20:25:20 +0100 Subject: [feat] add support for the blob interface Pysqlcipher support for the sqlite blob interface: https://sqlite.org/c3ref/blob_open.html Copying the code from the PR in pysqlite: https://github.com/ghaering/pysqlite/pull/93 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 86c43b4..1b3993e 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ PATCH_VERSION = None sources = ["src/module.c", "src/connection.c", "src/cursor.c", "src/cache.c", "src/microprotocols.c", "src/prepare_protocol.c", "src/statement.c", - "src/util.c", "src/row.c"] + "src/util.c", "src/row.c", "src/blob.c"] if PYSQLITE_EXPERIMENTAL: sources.append("src/backup.c") -- cgit v1.2.3 From 595d19694e341184ddcdda4b9847c62a7692f552 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Wed, 8 Feb 2017 21:32:19 +0100 Subject: bump version to 2.6.9 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 1b3993e..b6f4289 100644 --- a/setup.py +++ b/setup.py @@ -309,7 +309,7 @@ def get_setup_args(): PYSQLITE_VERSION += "-%s" % PATCH_VERSION # Need to bump minor version, patch handled badly. - PYSQLCIPHER_VERSION = "2.6.8" + PYSQLCIPHER_VERSION = "2.6.9" setup_args = dict( name="pysqlcipher", -- cgit v1.2.3 From ee4653731af43ee5d3a82e4025869538d3345f0a Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Thu, 13 Apr 2017 15:21:19 +0200 Subject: cleanup setup removing some past experiments, not used --- setup.py | 189 ++++++++++++++++----------------------------------------------- 1 file changed, 46 insertions(+), 143 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index b6f4289..6e6938a 100644 --- a/setup.py +++ b/setup.py @@ -130,151 +130,54 @@ class LibSQLCipherBuilder(build_ext): class AmalgamationBuildExt(build_ext): - amalgamation = True # We want amalgamation on the default build for now - static = False + + amalgamation = True def build_extension(self, ext): - if self.amalgamation: - # build with fulltext search enabled - ext.define_macros.append( - ("SQLITE_ENABLE_FTS3", "1")) - ext.define_macros.append( - ("SQLITE_ENABLE_FTS5", "1")) - ext.define_macros.append( - ("SQLITE_ENABLE_RTREE", "1")) - - # SQLCipher options - ext.define_macros.append( - ("SQLITE_ENABLE_LOAD_EXTENSION", "1")) - ext.define_macros.append( - ("SQLITE_HAS_CODEC", "1")) - ext.define_macros.append( - ("SQLITE_TEMP_STORE", "2")) - ext.define_macros.append( - ("HAVE_USLEEP", "1")) - - ext.sources.append(os.path.join(AMALGAMATION_ROOT, "sqlite3.c")) - ext.include_dirs.append(AMALGAMATION_ROOT) - - if sys.platform == "win32": - # Try to locate openssl - openssl_conf = os.environ.get('OPENSSL_CONF') - if not openssl_conf: - sys.exit('Fatal error: OpenSSL could not be detected!') - openssl = os.path.dirname(os.path.dirname(openssl_conf)) - - # Configure the compiler - ext.include_dirs.append(os.path.join(openssl, "include")) - ext.define_macros.append(("inline", "__inline")) - - # Configure the linker - if self.compiler.compiler_type == "msvc": - ext.extra_link_args.append("libeay32.lib") - ext.extra_link_args.append( - "/LIBPATH:" + os.path.join(openssl, "lib") - ) - if self.compiler.compiler_type == "mingw32": - ext.extra_link_args.append("-lcrypto") - else: + # build with fulltext search enabled + ext.define_macros.append( + ("SQLITE_ENABLE_FTS3", "1")) + ext.define_macros.append( + ("SQLITE_ENABLE_FTS5", "1")) + ext.define_macros.append( + ("SQLITE_ENABLE_RTREE", "1")) + + # SQLCipher options + ext.define_macros.append( + ("SQLITE_ENABLE_LOAD_EXTENSION", "1")) + ext.define_macros.append( + ("SQLITE_HAS_CODEC", "1")) + ext.define_macros.append( + ("SQLITE_TEMP_STORE", "2")) + ext.define_macros.append( + ("HAVE_USLEEP", "1")) + + ext.sources.append(os.path.join(AMALGAMATION_ROOT, "sqlite3.c")) + ext.include_dirs.append(AMALGAMATION_ROOT) + + if sys.platform == "win32": + # Try to locate openssl + openssl_conf = os.environ.get('OPENSSL_CONF') + if not openssl_conf: + sys.exit('Fatal error: OpenSSL could not be detected!') + openssl = os.path.dirname(os.path.dirname(openssl_conf)) + + # Configure the compiler + ext.include_dirs.append(os.path.join(openssl, "include")) + ext.define_macros.append(("inline", "__inline")) + + # Configure the linker + if self.compiler.compiler_type == "msvc": + ext.extra_link_args.append("libeay32.lib") + ext.extra_link_args.append( + "/LIBPATH:" + os.path.join(openssl, "lib") + ) + if self.compiler.compiler_type == "mingw32": ext.extra_link_args.append("-lcrypto") - - if self.static: - self._build_extension(ext) - else: - build_ext.build_extension(self, ext) - - def _build_extension(self, ext): - sources = ext.sources - if sources is None or type(sources) not in (ListType, TupleType): - raise DistutilsSetupError, \ - ("in 'ext_modules' option (extension '%s'), " + - "'sources' must be present and must be " + - "a list of source filenames") % ext.name - sources = list(sources) - - ext_path = self.get_ext_fullpath(ext.name) - depends = sources + ext.depends - if not (self.force or newer_group(depends, ext_path, 'newer')): - log.debug("skipping '%s' extension (up-to-date)", ext.name) - return else: - log.info("building '%s' extension", ext.name) - - # First, scan the sources for SWIG definition files (.i), run - # SWIG on 'em to create .c files, and modify the sources list - # accordingly. - sources = self.swig_sources(sources, ext) - - # Next, compile the source code to object files. - - # XXX not honouring 'define_macros' or 'undef_macros' -- the - # CCompiler API needs to change to accommodate this, and I - # want to do one thing at a time! - - # Two possible sources for extra compiler arguments: - # - 'extra_compile_args' in Extension object - # - CFLAGS environment variable (not particularly - # elegant, but people seem to expect it and I - # guess it's useful) - # The environment variable should take precedence, and - # any sensible compiler will give precedence to later - # command line args. Hence we combine them in order: - extra_args = ext.extra_compile_args or [] - - macros = ext.define_macros[:] - for undef in ext.undef_macros: - macros.append((undef,)) - - objects = self.compiler.compile(sources, - output_dir=self.build_temp, - macros=macros, - include_dirs=ext.include_dirs, - debug=self.debug, - extra_postargs=extra_args, - depends=ext.depends) - - # XXX -- this is a Vile HACK! - # - # The setup.py script for Python on Unix needs to be able to - # get this list so it can perform all the clean up needed to - # avoid keeping object files around when cleaning out a failed - # build of an extension module. Since Distutils does not - # track dependencies, we have to get rid of intermediates to - # ensure all the intermediates will be properly re-built. - # - self._built_objects = objects[:] - - # Now link the object files together into a "shared object" -- - # of course, first we have to figure out all the other things - # that go into the mix. - if ext.extra_objects: - objects.extend(ext.extra_objects) - extra_args = ext.extra_link_args or [] - - # Detect target language, if not provided - language = ext.language or self.compiler.detect_language(sources) - - #self.compiler.link_shared_object( - #objects, ext_path, - #libraries=self.get_libraries(ext), - #library_dirs=ext.library_dirs, - #runtime_library_dirs=ext.runtime_library_dirs, - #extra_postargs=extra_args, - #export_symbols=self.get_export_symbols(ext), - #debug=self.debug, - #build_temp=self.build_temp, - #target_lang=language) - - # XXX may I have a static lib please? - # hmm but then I cannot load that extension, or can I? - output_dir = os.path.sep.join(ext_path.split(os.path.sep)[:-1]) - - self.compiler.create_static_lib( - objects, - #XXX get library name ... splitting ext_path? - "sqlite", - output_dir=output_dir, - target_lang=language) + ext.extra_link_args.append("-lcrypto") + + build_ext.build_extension(self, ext) def __setattr__(self, k, v): # Make sure we don't link against the SQLite @@ -309,7 +212,7 @@ def get_setup_args(): PYSQLITE_VERSION += "-%s" % PATCH_VERSION # Need to bump minor version, patch handled badly. - PYSQLCIPHER_VERSION = "2.6.9" + PYSQLCIPHER_VERSION = "2.6.10" setup_args = dict( name="pysqlcipher", @@ -356,7 +259,7 @@ def get_setup_args(): if BUNDLED: - build_ext = AmalgamationBuildExt + build_ext = AmalgamationBuildExt else: build_ext = LibSQLCipherBuilder -- cgit v1.2.3