Cleaning setup.py
This commit is contained in:
parent
2d37b15c9e
commit
86ad19dd52
2 changed files with 68 additions and 68 deletions
|
|
@ -28,3 +28,6 @@ requires = [
|
||||||
"wheel",
|
"wheel",
|
||||||
]
|
]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[tool.setuptools]
|
||||||
|
packages = ["sqlcipher3"]
|
||||||
131
setup.py
131
setup.py
|
|
@ -114,74 +114,71 @@ def quote_argument(arg):
|
||||||
q = '\\"' if sys.platform == "win32" and sys.version_info < (3, 7) else '"'
|
q = '\\"' if sys.platform == "win32" and sys.version_info < (3, 7) else '"'
|
||||||
return q + arg + q
|
return q + arg + q
|
||||||
|
|
||||||
define_macros = [
|
|
||||||
("MODULE_NAME", quote_argument("sqlcipher3.dbapi2")),
|
|
||||||
("ENABLE_FTS3", "1"),
|
|
||||||
("ENABLE_FTS3_PARENTHESIS", "1"),
|
|
||||||
("ENABLE_FTS4", "1"),
|
|
||||||
("ENABLE_FTS5", "1"),
|
|
||||||
("ENABLE_JSON1", "1"),
|
|
||||||
("ENABLE_LOAD_EXTENSION", "1"),
|
|
||||||
("ENABLE_RTREE", "1"),
|
|
||||||
("ENABLE_STAT4", "1"),
|
|
||||||
("ENABLE_UPDATE_DELETE_LIMIT", "1"),
|
|
||||||
("SOUNDEX", "1"),
|
|
||||||
("USE_URI", "1"),
|
|
||||||
# Required for SQLCipher.
|
|
||||||
("SQLITE_HAS_CODEC", "1"),
|
|
||||||
("HAS_CODEC", "1"),
|
|
||||||
("SQLITE_TEMP_STORE", "2"),
|
|
||||||
# Increase the maximum number of "host parameters".
|
|
||||||
("SQLITE_MAX_VARIABLE_NUMBER", "250000"),
|
|
||||||
# Additional nice-to-have.
|
|
||||||
("SQLITE_DEFAULT_PAGE_SIZE", "4096"),
|
|
||||||
("SQLITE_DEFAULT_CACHE_SIZE", "-8000"),
|
|
||||||
("inline", "__inline"),
|
|
||||||
]
|
|
||||||
|
|
||||||
# Configure the compiler
|
|
||||||
arch = get_arch()
|
|
||||||
if arch == "universal2":
|
|
||||||
conan_info_x64 = install_openssl("x86_64")
|
|
||||||
add_deps(conan_info_x64, library_dirs, include_dirs)
|
|
||||||
conan_info_arm = install_openssl("armv8")
|
|
||||||
add_deps(conan_info_arm, library_dirs, include_dirs)
|
|
||||||
zlib_required = check_zlib_required(conan_info_x64)
|
|
||||||
else:
|
|
||||||
conan_info = install_openssl(arch)
|
|
||||||
add_deps(conan_info, library_dirs, include_dirs)
|
|
||||||
zlib_required = check_zlib_required(conan_info)
|
|
||||||
|
|
||||||
# Configure the linker
|
|
||||||
extra_link_args = []
|
|
||||||
if sys.platform == "win32":
|
|
||||||
# https://github.com/openssl/openssl/blob/master/NOTES-WINDOWS.md#linking-native-applications
|
|
||||||
extra_link_args.append("WS2_32.LIB")
|
|
||||||
extra_link_args.append("GDI32.LIB")
|
|
||||||
extra_link_args.append("ADVAPI32.LIB")
|
|
||||||
extra_link_args.append("CRYPT32.LIB")
|
|
||||||
extra_link_args.append("USER32.LIB")
|
|
||||||
if zlib_required:
|
|
||||||
extra_link_args.append("zlib.lib")
|
|
||||||
extra_link_args.append("libcrypto.lib")
|
|
||||||
else:
|
|
||||||
# Include math library, required for fts5, and crypto.
|
|
||||||
extra_link_args.extend(["-lm", "-lcrypto"])
|
|
||||||
|
|
||||||
module = Extension(
|
|
||||||
name="sqlcipher3._sqlite3",
|
|
||||||
sources=sources,
|
|
||||||
define_macros=define_macros,
|
|
||||||
library_dirs=library_dirs,
|
|
||||||
include_dirs=include_dirs,
|
|
||||||
extra_link_args=extra_link_args,
|
|
||||||
language="c",
|
|
||||||
)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
define_macros = [
|
||||||
|
("MODULE_NAME", quote_argument("sqlcipher3.dbapi2")),
|
||||||
|
("ENABLE_FTS3", "1"),
|
||||||
|
("ENABLE_FTS3_PARENTHESIS", "1"),
|
||||||
|
("ENABLE_FTS4", "1"),
|
||||||
|
("ENABLE_FTS5", "1"),
|
||||||
|
("ENABLE_JSON1", "1"),
|
||||||
|
("ENABLE_LOAD_EXTENSION", "1"),
|
||||||
|
("ENABLE_RTREE", "1"),
|
||||||
|
("ENABLE_STAT4", "1"),
|
||||||
|
("ENABLE_UPDATE_DELETE_LIMIT", "1"),
|
||||||
|
("SOUNDEX", "1"),
|
||||||
|
("USE_URI", "1"),
|
||||||
|
# Required for SQLCipher.
|
||||||
|
("SQLITE_HAS_CODEC", "1"),
|
||||||
|
("HAS_CODEC", "1"),
|
||||||
|
("SQLITE_TEMP_STORE", "2"),
|
||||||
|
# Increase the maximum number of "host parameters".
|
||||||
|
("SQLITE_MAX_VARIABLE_NUMBER", "250000"),
|
||||||
|
# Additional nice-to-have.
|
||||||
|
("SQLITE_DEFAULT_PAGE_SIZE", "4096"),
|
||||||
|
("SQLITE_DEFAULT_CACHE_SIZE", "-8000"),
|
||||||
|
("inline", "__inline"),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Configure the compiler
|
||||||
|
arch = get_arch()
|
||||||
|
if arch == "universal2":
|
||||||
|
conan_info_x64 = install_openssl("x86_64")
|
||||||
|
add_deps(conan_info_x64, library_dirs, include_dirs)
|
||||||
|
conan_info_arm = install_openssl("armv8")
|
||||||
|
add_deps(conan_info_arm, library_dirs, include_dirs)
|
||||||
|
zlib_required = check_zlib_required(conan_info_x64)
|
||||||
|
else:
|
||||||
|
conan_info = install_openssl(arch)
|
||||||
|
add_deps(conan_info, library_dirs, include_dirs)
|
||||||
|
zlib_required = check_zlib_required(conan_info)
|
||||||
|
|
||||||
|
# Configure the linker
|
||||||
|
extra_link_args = []
|
||||||
|
if sys.platform == "win32":
|
||||||
|
# https://github.com/openssl/openssl/blob/master/NOTES-WINDOWS.md#linking-native-applications
|
||||||
|
extra_link_args.append("WS2_32.LIB")
|
||||||
|
extra_link_args.append("GDI32.LIB")
|
||||||
|
extra_link_args.append("ADVAPI32.LIB")
|
||||||
|
extra_link_args.append("CRYPT32.LIB")
|
||||||
|
extra_link_args.append("USER32.LIB")
|
||||||
|
if zlib_required:
|
||||||
|
extra_link_args.append("zlib.lib")
|
||||||
|
extra_link_args.append("libcrypto.lib")
|
||||||
|
else:
|
||||||
|
# Include math library, required for fts5, and crypto.
|
||||||
|
extra_link_args.extend(["-lm", "-lcrypto"])
|
||||||
|
|
||||||
|
module = Extension(
|
||||||
|
name="sqlcipher3._sqlite3",
|
||||||
|
sources=sources,
|
||||||
|
define_macros=define_macros,
|
||||||
|
library_dirs=library_dirs,
|
||||||
|
include_dirs=include_dirs,
|
||||||
|
extra_link_args=extra_link_args,
|
||||||
|
language="c",
|
||||||
|
)
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
platforms="ALL",
|
|
||||||
package_dir={"sqlcipher3": "sqlcipher3"},
|
|
||||||
packages=["sqlcipher3"],
|
|
||||||
ext_modules=[module],
|
ext_modules=[module],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue