Use pyproject.toml

This commit is contained in:
laggykiller 2024-02-24 03:56:27 +08:00
parent 7edd065ce3
commit 3ad1b108a4
6 changed files with 271603 additions and 41 deletions

View file

@ -21,8 +21,36 @@ jobs:
sqlcipher/sqlite3.c sqlcipher/sqlite3.c
sqlcipher/sqlite3.h sqlcipher/sqlite3.h
build-wheels: tests:
needs: [prepare-sqlite] needs: [prepare-sqlite]
strategy:
fail-fast: true
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']
os: [ubuntu-20.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: false
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v3
with:
name: sqlite-amalgamation
path: ./src/sqlcipher
- name: Build module
run: |
python setup.py build_ext -i
- name: Run tests
run: |
python -m test
build-wheels:
needs: [prepare-sqlite, tests]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
@ -108,10 +136,6 @@ jobs:
name: sqlite-amalgamation name: sqlite-amalgamation
path: ./ path: ./
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel cibuildwheel
- name: Build wheels for ${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }} - name: Build wheels for ${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}
uses: pypa/cibuildwheel@v2.15.0 uses: pypa/cibuildwheel@v2.15.0
env: env:
@ -128,7 +152,7 @@ jobs:
retention-days: 7 retention-days: 7
build-sdist: build-sdist:
needs: [prepare-sqlite] needs: [prepare-sqlite, tests]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -145,10 +169,6 @@ jobs:
name: sqlite-amalgamation name: sqlite-amalgamation
path: ./ path: ./
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
- name: Build sdist - name: Build sdist
run: | run: |
python setup.py sdist python setup.py sdist

30
pyproject.toml Normal file
View file

@ -0,0 +1,30 @@
[project]
name = "sqlcipher3"
version = "0.5.2"
description = "DB-API 2.0 interface for SQLCipher 3.x"
readme = { content-type = "text/markdown", file = "README.md" }
authors = [{ name = "Charles Leifer", email = "coleifer@gmail.com" }]
license = { text = "zlib/libpng" }
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: zlib/libpng License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: C",
"Programming Language :: Python",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Software Development :: Libraries :: Python Modules",
]
[project.urls]
homepage = "https://github.com/coleifer/sqlcipher3"
[build-system]
requires = [
"conan>=2.0",
"setuptools>=45",
"wheel",
]
build-backend = "setuptools.build_meta"

View file

@ -1,7 +0,0 @@
[build_ext]
include_dirs=/usr/include
library_dirs=/usr/lib
[options]
setup_requires =
conan >= 2.0

View file

@ -10,11 +10,6 @@ import platform
from glob import glob from glob import glob
from setuptools import setup, Extension from setuptools import setup, Extension
# If you need to change anything, it should be enough to change setup.cfg.
PACKAGE_NAME = 'sqlcipher3'
VERSION = '0.5.2'
# Mapping from Conan architectures to Python machine types # Mapping from Conan architectures to Python machine types
CONAN_ARCHS = { CONAN_ARCHS = {
'x86_64': ['amd64', 'x86_64', 'x64'], 'x86_64': ['amd64', 'x86_64', 'x64'],
@ -29,10 +24,6 @@ sources = glob("src/*.c") + ["src/sqlcipher/sqlite3.c"]
include_dirs = ["./src"] include_dirs = ["./src"]
# define packages
packages = [PACKAGE_NAME]
EXTENSION_MODULE_NAME = "._sqlite3"
# Work around clang raising hard error for unused arguments # Work around clang raising hard error for unused arguments
if sys.platform == "darwin": if sys.platform == "darwin":
os.environ['CFLAGS'] = "-Qunused-arguments" os.environ['CFLAGS'] = "-Qunused-arguments"
@ -112,7 +103,7 @@ def quote_argument(arg):
return q + arg + q return q + arg + q
define_macros = [ define_macros = [
('MODULE_NAME', quote_argument(PACKAGE_NAME + '.dbapi2')), ('MODULE_NAME', quote_argument('sqlcipher3.dbapi2')),
('ENABLE_FTS3', '1'), ('ENABLE_FTS3', '1'),
('ENABLE_FTS3_PARENTHESIS', '1'), ('ENABLE_FTS3_PARENTHESIS', '1'),
('ENABLE_FTS4', '1'), ('ENABLE_FTS4', '1'),
@ -182,7 +173,7 @@ else:
extra_link_args.append('libcrypto.a') extra_link_args.append('libcrypto.a')
module = Extension( module = Extension(
name=PACKAGE_NAME + EXTENSION_MODULE_NAME, name="sqlcipher3._sqlite3",
sources=sources, sources=sources,
define_macros=define_macros, define_macros=define_macros,
library_dirs=[openssl_lib_path], library_dirs=[openssl_lib_path],
@ -191,22 +182,11 @@ module = Extension(
language="c", language="c",
) )
with open("README.md", "r", encoding="utf-8") as fr:
long_description = fr.read()
if __name__ == "__main__": if __name__ == "__main__":
setup( setup(
name=PACKAGE_NAME,
version=VERSION,
description="DB-API 2.0 interface for SQLCipher 3.x",
long_description=long_description,
author="Charles Leifer",
author_email="coleifer@gmail.com",
license="zlib/libpng",
platforms="ALL", platforms="ALL",
url="https://github.com/coleifer/sqlcipher3", package_dir={'sqlcipher3': "sqlcipher3"},
package_dir={PACKAGE_NAME: "sqlcipher3"}, packages=['sqlcipher3'],
packages=packages,
ext_modules=[module], ext_modules=[module],
classifiers=[ classifiers=[
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",

258179
src/sqlcipher/sqlite3.c Normal file

File diff suppressed because it is too large Load diff

13360
src/sqlcipher/sqlite3.h Normal file

File diff suppressed because it is too large Load diff