Copy header file into sqlcipher/ dir when building amalgamation.
Alternative fix for #2.
This commit is contained in:
parent
5b557deffd
commit
9b2f2bf97c
2 changed files with 13 additions and 3 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
sqlcipher/sqlite3.h
|
||||||
|
build/*
|
||||||
|
dist/*
|
||||||
|
sqlcipher3.egg-info/*
|
||||||
12
setup.py
12
setup.py
|
|
@ -3,6 +3,7 @@
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import setuptools
|
import setuptools
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from distutils import log
|
from distutils import log
|
||||||
|
|
@ -52,20 +53,25 @@ class AmalgationLibSqliteBuilder(build_ext):
|
||||||
amalgamation_header = os.path.join(amalgamation_root, 'sqlite3.h')
|
amalgamation_header = os.path.join(amalgamation_root, 'sqlite3.h')
|
||||||
amalgamation_source = os.path.join(amalgamation_root, 'sqlite3.c')
|
amalgamation_source = os.path.join(amalgamation_root, 'sqlite3.c')
|
||||||
|
|
||||||
|
header_dir = os.path.join(amalgamation_root, 'sqlcipher')
|
||||||
|
header_file = os.path.join(header_dir, 'sqlite3.h')
|
||||||
|
|
||||||
amalgamation_message = ('Sqlcipher amalgamation not found. Please download'
|
amalgamation_message = ('Sqlcipher amalgamation not found. Please download'
|
||||||
' or build the amalgamation and make sure the '
|
' or build the amalgamation and make sure the '
|
||||||
'following files are present in the sqlcipher3 '
|
'following files are present in the sqlcipher3 '
|
||||||
'folder: sqlite3.h, sqlite3.c')
|
'folder: sqlite3.h, sqlite3.c')
|
||||||
|
|
||||||
def check_amalgamation(self):
|
def check_amalgamation(self):
|
||||||
if not os.path.exists(self.amalgamation_root):
|
|
||||||
os.mkdir(self.amalgamation_root)
|
|
||||||
|
|
||||||
header_exists = os.path.exists(self.amalgamation_header)
|
header_exists = os.path.exists(self.amalgamation_header)
|
||||||
source_exists = os.path.exists(self.amalgamation_source)
|
source_exists = os.path.exists(self.amalgamation_source)
|
||||||
if not header_exists or not source_exists:
|
if not header_exists or not source_exists:
|
||||||
raise RuntimeError(self.amalgamation_message)
|
raise RuntimeError(self.amalgamation_message)
|
||||||
|
|
||||||
|
if not os.path.exists(self.header_dir):
|
||||||
|
os.mkdir(self.header_dir)
|
||||||
|
if not os.path.exists(self.header_file):
|
||||||
|
shutil.copy(self.amalgamation_header, self.header_file)
|
||||||
|
|
||||||
def build_extension(self, ext):
|
def build_extension(self, ext):
|
||||||
log.info(self.description)
|
log.info(self.description)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue