Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3dc6bb3c
Commit
3dc6bb3c
authored
Apr 03, 2006
by
Anthony Baxter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
parent
04ee8709
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
30 deletions
+22
-30
setup.py
setup.py
+22
-30
No files found.
setup.py
View file @
3dc6bb3c
...
...
@@ -692,50 +692,42 @@ class PyBuildExt(build_ext):
# The sqlite interface
sqlite_setup_debug = True # verbose debug prints from this script?
# We hunt for
"
#define SQLITE_VERSION_NUMBER nnnn
n"
# We need to find
a version >= 3002002 (> sqlite version 3.2.2)
# We hunt for
#define SQLITE_VERSION "
n
.
n
.
n
"
# We need to find
>= sqlite version 3.0.8
sqlite_incdir = sqlite_libdir = None
sqlite_inc_paths
=
[
'/usr/include'
,
sqlite_inc_paths = [ '/usr/include',
'/usr/include/sqlite',
'/usr/include/sqlite3',
'/usr/local/include',
'/usr/local/include/sqlite',
'/usr/local/include/sqlite3',
]
MIN_SQLITE_VERSION_NUMBER
=
3000008
MIN_SQLITE_VERSION
=
"3.0.8"
MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
MIN_SQLITE_VERSION = "
.
".join([str(x)
for x in MIN_SQLITE_VERSION_NUMBER])
for d in sqlite_inc_paths + inc_dirs:
f = os.path.join(d, "
sqlite3
.
h
")
if os.path.exists(f):
if sqlite_setup_debug: print "
sqlite
:
found
%
s
"%f
f
=
open
(
f
).
read
()
m
=
re
.
search
(
r"#define\
WSQLITE_VERSION_NUMBER
\W(\
d+)
", f)
incf = open(f).read()
m = re.search(
r'
\
s*.*#
\
s*.*define
\
s.*SQLITE_VERSION
\
W*"
(.
*
)
"', incf)
if m:
sqlite_version = int(m.group(1))
if sqlite_version >= MIN_SQLITE_VERSION_NUMBER:
sqlite_version = m.group(1)
sqlite_version_tuple = tuple([int(x)
for x in sqlite_version.split("
.
")])
if sqlite_version_tuple >= MIN_SQLITE_VERSION_NUMBER:
# we win!
print "
%
s
/
sqlite3
.
h
:
version
%
s
"%(d, sqlite_version)
sqlite_incdir = d
break
elif sqlite_version == 3000000:
# Bug in a common version out there where
# SQLITE_VERSION_NUMBER was set incorrectly
if sqlite_setup_debug:
print "
found
buggy
SQLITE_VERSION_NUMBER
,
checking
"
m = re.search(r'#define
\
WSQLITE_VERSION
\
W+"
([
\
.
\
d
]
+
)
"',
f)
if m:
sqlite_version = m.group(1)
if sqlite_version >= MIN_SQLITE_VERSION:
print "
%
s
/
sqlite3
.
h
:
version
%
s
"%(d,
sqlite_version)
sqlite_incdir = d
break
else:
if sqlite_setup_debug:
if sqlite_setup_debug:
print "
%
s
:
version
%
d
is
too
old
,
need
>=
%
s
"%(d,
sqlite_version, MIN_SQLITE_VERSION)
elif sqlite_setup_debug:
print "
sqlite
:
%
s
had
no
SQLITE_VERSION
"%(f,)
if sqlite_incdir:
sqlite_dirs_to_check = [
os.path.join(sqlite_incdir, '..', 'lib64'),
...
...
@@ -763,19 +755,19 @@ class PyBuildExt(build_ext):
PYSQLITE_VERSION = "
2.1
.
3
"
sqlite_defines = []
if sys.platform != "
win32
":
sqlite_defines.append(('PYSQLITE_VERSION',
sqlite_defines.append(('PYSQLITE_VERSION',
'"
%
s
"' % PYSQLITE_VERSION))
else:
sqlite_defines.append(('PYSQLITE_VERSION',
sqlite_defines.append(('PYSQLITE_VERSION',
'
\
\
"'+PYSQLITE_VERSION+'
\\
"'))
sqlite_defines.append(('PY_MAJOR_VERSION',
sqlite_defines.append(('PY_MAJOR_VERSION',
str(sys.version_info[0])))
sqlite_defines.append(('PY_MINOR_VERSION',
sqlite_defines.append(('PY_MINOR_VERSION',
str(sys.version_info[1])))
exts.append(Extension('_sqlite3', sqlite_srcs,
define_macros=sqlite_defines,
include_dirs=["
Modules
/
_sqlite
",
include_dirs=["
Modules
/
_sqlite
",
sqlite_incdir],
library_dirs=sqlite_libdir,
runtime_library_dirs=sqlite_libdir,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment