Kaydet (Commit) 3e99c0ad authored tarafından Gerhard Häring's avatar Gerhard Häring

Updated the sqlite3 module to the external pysqlite 2.2.2 version.

üst 5ef9d9fd
......@@ -22,6 +22,9 @@
# 3. This notice may not be removed or altered from any source distribution.
import datetime
import time
from _sqlite3 import *
paramstyle = "qmark"
......@@ -29,10 +32,6 @@ threadsafety = 1
apilevel = "2.0"
from _sqlite3 import *
import datetime, time
Date = datetime.date
Time = datetime.time
......@@ -40,45 +39,50 @@ Time = datetime.time
Timestamp = datetime.datetime
def DateFromTicks(ticks):
return apply(Date,time.localtime(ticks)[:3])
return apply(Date, time.localtime(ticks)[:3])
def TimeFromTicks(ticks):
return apply(Time,time.localtime(ticks)[3:6])
return apply(Time, time.localtime(ticks)[3:6])
def TimestampFromTicks(ticks):
return apply(Timestamp,time.localtime(ticks)[:6])
return apply(Timestamp, time.localtime(ticks)[:6])
_major, _minor, _micro = version.split(".")
version_info = (int(_major), int(_minor), _micro)
_major, _minor, _micro = sqlite_version.split(".")
sqlite_version_info = (int(_major), int(_minor), _micro)
version_info = tuple([int(x) for x in version.split(".")])
sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")])
Binary = buffer
def adapt_date(val):
return val.isoformat()
def register_adapters_and_converters():
def adapt_date(val):
return val.isoformat()
def adapt_datetime(val):
return val.isoformat(" ")
def convert_date(val):
return datetime.date(*map(int, val.split("-")))
def convert_timestamp(val):
datepart, timepart = val.split(" ")
year, month, day = map(int, datepart.split("-"))
timepart_full = timepart.split(".")
hours, minutes, seconds = map(int, timepart_full[0].split(":"))
if len(timepart_full) == 2:
microseconds = int(float("0." + timepart_full[1]) * 1000000)
else:
microseconds = 0
def adapt_datetime(val):
return val.isoformat(" ")
val = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds)
return val
def convert_date(val):
return datetime.date(*map(int, val.split("-")))
def convert_timestamp(val):
datepart, timepart = val.split(" ")
year, month, day = map(int, datepart.split("-"))
timepart_full = timepart.split(".")
hours, minutes, seconds = map(int, timepart_full[0].split(":"))
if len(timepart_full) == 2:
microseconds = int(float("0." + timepart_full[1]) * 1000000)
else:
microseconds = 0
register_adapter(datetime.date, adapt_date)
register_adapter(datetime.datetime, adapt_datetime)
register_converter("date", convert_date)
register_converter("timestamp", convert_timestamp)
val = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds)
return val
register_adapters_and_converters()
# Clean up namespace
register_adapter(datetime.date, adapt_date)
register_adapter(datetime.datetime, adapt_datetime)
register_converter("date", convert_date)
register_converter("timestamp", convert_timestamp)
del(register_adapters_and_converters)
......@@ -22,7 +22,7 @@
# 3. This notice may not be removed or altered from any source distribution.
import os, unittest
import pysqlite2.dbapi2 as sqlite
import sqlite3 as sqlite
class CollationTests(unittest.TestCase):
def setUp(self):
......@@ -72,7 +72,7 @@ class CollationTests(unittest.TestCase):
result = con.execute(sql).fetchall()
self.fail("should have raised an OperationalError")
except sqlite.OperationalError, e:
self.failUnlessEqual(e.args[0], "no such collation sequence: mycoll")
self.failUnlessEqual(e.args[0].lower(), "no such collation sequence: mycoll")
def CheckCollationRegisterTwice(self):
"""
......
......@@ -22,7 +22,7 @@
# 3. This notice may not be removed or altered from any source distribution.
import unittest
import pysqlite2.dbapi2 as sqlite
import sqlite3 as sqlite
class RegressionTests(unittest.TestCase):
def setUp(self):
......@@ -36,6 +36,31 @@ class RegressionTests(unittest.TestCase):
cur = self.con.cursor()
cur.execute("pragma user_version")
def CheckPragmaSchemaVersion(self):
# This still crashed pysqlite <= 2.2.1
con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)
try:
cur = self.con.cursor()
cur.execute("pragma schema_version")
finally:
cur.close()
con.close()
def CheckStatementReset(self):
# pysqlite 2.1.0 to 2.2.0 have the problem that not all statements are
# reset before a rollback, but only those that are still in the
# statement cache. The others are not accessible from the connection object.
con = sqlite.connect(":memory:", cached_statements=5)
cursors = [con.cursor() for x in xrange(5)]
cursors[0].execute("create table test(x)")
for i in range(10):
cursors[0].executemany("insert into test(x) values (?)", [(x,) for x in xrange(10)])
for i in range(5):
cursors[i].execute(" " * i + "select x from test")
con.rollback()
def suite():
regression_suite = unittest.makeSuite(RegressionTests, "Check")
return unittest.TestSuite((regression_suite,))
......
......@@ -134,6 +134,13 @@ class FunctionTests(unittest.TestCase):
def tearDown(self):
self.con.close()
def CheckFuncErrorOnCreate(self):
try:
self.con.create_function("bla", -100, lambda x: 2*x)
self.fail("should have raised an OperationalError")
except sqlite.OperationalError:
pass
def CheckFuncRefCount(self):
def getfunc():
def f():
......@@ -251,6 +258,13 @@ class AggregateTests(unittest.TestCase):
#self.con.close()
pass
def CheckAggrErrorOnCreate(self):
try:
self.con.create_function("bla", -100, AggrSum)
self.fail("should have raised an OperationalError")
except sqlite.OperationalError:
pass
def CheckAggrNoStep(self):
cur = self.con.cursor()
cur.execute("select nostep(t) from test")
......
......@@ -6,11 +6,12 @@ try:
except ImportError:
raise TestSkipped('no sqlite available')
from sqlite3.test import (dbapi, types, userfunctions,
factory, transactions)
factory, transactions, hooks, regression)
def test_main():
run_unittest(dbapi.suite(), types.suite(), userfunctions.suite(),
factory.suite(), transactions.suite())
factory.suite(), transactions.suite(), hooks.suite(),
regression.suite())
if __name__ == "__main__":
test_main()
/* adapters.c - default adapters
*
* Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 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.
*/
#include "util.h"
#include "module.h"
#include "adapters.h"
/* dummy, will be implemented in a later version */
PyObject* adapt_date(PyObject* self, PyObject* args, PyObject* kwargs)
{
Py_INCREF(Py_None);
return Py_None;
}
PyObject* adapt_datetime(PyObject* self, PyObject* args, PyObject* kwargs)
{
Py_INCREF(Py_None);
return Py_None;
}
/* adapters.h - default adapters
*
* Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 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.
*/
#ifndef PYSQLITE_ADAPTERS_H
#define PYSQLITE_ADAPTERS_H
#include "Python.h"
#include "pythread.h"
#include "sqlite3.h"
PyObject* adapt_date(PyObject* self, PyObject* args, PyObject* kwargs);
PyObject* adapt_datetime(PyObject* self, PyObject* args, PyObject* kwargs);
#endif
......@@ -22,6 +22,7 @@
*/
#include "cache.h"
#include <limits.h>
/* only used internally */
Node* new_node(PyObject* key, PyObject* data)
......@@ -60,11 +61,11 @@ int cache_init(Cache* self, PyObject* args, PyObject* kwargs)
self->factory = NULL;
if (!PyArg_ParseTuple(args, "O|i", &factory, &size))
{
return -1;
if (!PyArg_ParseTuple(args, "O|i", &factory, &size)) {
return -1;
}
/* minimum cache size is 5 entries */
if (size < 5) {
size = 5;
}
......@@ -95,6 +96,7 @@ void cache_dealloc(Cache* self)
return;
}
/* iterate over all nodes and deallocate them */
node = self->first;
while (node) {
delete_node = node;
......@@ -119,7 +121,14 @@ PyObject* cache_get(Cache* self, PyObject* args)
node = (Node*)PyDict_GetItem(self->mapping, key);
if (node) {
node->count++;
/* an entry for this key already exists in the cache */
/* increase usage counter of the node found */
if (node->count < LONG_MAX) {
node->count++;
}
/* if necessary, reorder entries in the cache by swapping positions */
if (node->prev && node->count > node->prev->count) {
ptr = node->prev;
......@@ -149,6 +158,10 @@ PyObject* cache_get(Cache* self, PyObject* args)
ptr->prev = node;
}
} else {
/* There is no entry for this key in the cache, yet. We'll insert a new
* entry in the cache, and make space if necessary by throwing the
* least used item out of the cache. */
if (PyDict_Size(self->mapping) == self->size) {
if (self->last) {
node = self->last;
......@@ -253,7 +266,7 @@ PyObject* cache_display(Cache* self, PyObject* args)
static PyMethodDef cache_methods[] = {
{"get", (PyCFunction)cache_get, METH_O,
PyDoc_STR("Gets an entry from the cache.")},
PyDoc_STR("Gets an entry from the cache or calls the factory function to produce one.")},
{"display", (PyCFunction)cache_display, METH_NOARGS,
PyDoc_STR("For debugging only.")},
{NULL, NULL}
......
/* cache.h - definitions for the LRU cache
*
* Copyright (C) 2004-2005 Gerhard Häring <gh@ghaering.de>
* Copyright (C) 2004-2006 Gerhard Häring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
......@@ -25,6 +25,10 @@
#define PYSQLITE_CACHE_H
#include "Python.h"
/* The LRU cache is implemented as a combination of a doubly-linked with a
* dictionary. The list items are of type 'Node' and the dictionary has the
* nodes as values. */
typedef struct _Node
{
PyObject_HEAD
......@@ -39,10 +43,18 @@ typedef struct
{
PyObject_HEAD
int size;
/* a dictionary mapping keys to Node entries */
PyObject* mapping;
/* the factory callable */
PyObject* factory;
Node* first;
Node* last;
/* if set, decrement the factory function when the Cache is deallocated.
* this is almost always desirable, but not in the pysqlite context */
int decref_factory;
} Cache;
......
This diff is collapsed.
/* connection.h - definitions for the connection type
*
* Copyright (C) 2004-2005 Gerhard Häring <gh@ghaering.de>
* Copyright (C) 2004-2006 Gerhard Häring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
......@@ -37,7 +37,12 @@ typedef struct
PyObject_HEAD
sqlite3* db;
/* 1 if we are currently within a transaction, i. e. if a BEGIN has been
* issued */
int inTransaction;
/* the type detection mode. Only 0, PARSE_DECLTYPES, PARSE_COLNAMES or a
* bitwise combination thereof makes sense */
int detect_types;
/* the timeout value in seconds for database locks */
......@@ -54,13 +59,31 @@ typedef struct
* freed in connection destructor */
char* begin_statement;
/* 1 if a check should be performed for each API call if the connection is
* used from the same thread it was created in */
int check_same_thread;
/* thread identification of the thread the connection was created in */
long thread_ident;
Cache* statement_cache;
/* A list of weak references to statements used within this connection */
PyObject* statements;
/* a counter for how many statements were created in the connection. May be
* reset to 0 at certain intervals */
int created_statements;
PyObject* row_factory;
/* Determines how bytestrings from SQLite are converted to Python objects:
* - PyUnicode_Type: Python Unicode objects are constructed from UTF-8 bytestrings
* - OptimizedUnicode: Like before, but for ASCII data, only PyStrings are created.
* - PyString_Type: PyStrings are created as-is.
* - Any custom callable: Any object returned from the callable called with the bytestring
* as single parameter.
*/
PyObject* text_factory;
/* remember references to functions/classes used in
......
/* converters.c - default converters
*
* Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 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.
*/
#include "util.h"
#include "module.h"
#include "adapters.h"
/* dummy, will be implemented in a later version */
PyObject* convert_date(PyObject* self, PyObject* args, PyObject* kwargs)
{
Py_INCREF(Py_None);
return Py_None;
}
PyObject* convert_timestamp(PyObject* self, PyObject* args, PyObject* kwargs)
{
Py_INCREF(Py_None);
return Py_None;
}
/* converters.h - default converters
*
* Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 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.
*/
#ifndef PYSQLITE_CONVERTERS_H
#define PYSQLITE_CONVERTERS_H
#include "Python.h"
#include "pythread.h"
#include "sqlite3.h"
PyObject* convert_date(PyObject* self, PyObject* args, PyObject* kwargs);
PyObject* convert_timestamp(PyObject* self, PyObject* args, PyObject* kwargs);
#endif
......@@ -157,24 +157,24 @@ int build_row_cast_map(Cursor* self)
if (self->connection->detect_types | PARSE_COLNAMES) {
colname = sqlite3_column_name(self->statement->st, i);
if (colname) {
for (pos = colname; *pos != 0; pos++) {
if (*pos == '[') {
type_start = pos + 1;
} else if (*pos == ']' && type_start != (const char*)-1) {
key = PyString_FromStringAndSize(type_start, pos - type_start);
if (!key) {
/* creating a string failed, but it is too complicated
* to propagate the error here, we just assume there is
* no converter and proceed */
break;
}
for (pos = colname; *pos != 0; pos++) {
if (*pos == '[') {
type_start = pos + 1;
} else if (*pos == ']' && type_start != (const char*)-1) {
key = PyString_FromStringAndSize(type_start, pos - type_start);
if (!key) {
/* creating a string failed, but it is too complicated
* to propagate the error here, we just assume there is
* no converter and proceed */
converter = PyDict_GetItem(converters, key);
Py_DECREF(key);
break;
}
converter = PyDict_GetItem(converters, key);
Py_DECREF(key);
break;
}
}
}
......@@ -276,6 +276,7 @@ PyObject* _fetch_one_row(Cursor* self)
void* raw_buffer;
const char* val_str;
char buf[200];
const char* colname;
Py_BEGIN_ALLOW_THREADS
numcols = sqlite3_data_count(self->statement->st);
......@@ -340,8 +341,12 @@ PyObject* _fetch_one_row(Cursor* self)
self->connection->text_factory == OptimizedUnicode ? 1 : 0);
if (!converted) {
colname = sqlite3_column_name(self->statement->st, i);
if (colname) {
colname = "<unknown column name>";
}
PyOS_snprintf(buf, sizeof(buf) - 1, "Could not decode to UTF-8 column %s with text %s",
sqlite3_column_name(self->statement->st, i), val_str);
colname , val_str);
PyErr_SetString(OperationalError, buf);
}
} else if (self->connection->text_factory == (PyObject*)&PyString_Type) {
......@@ -419,8 +424,7 @@ PyObject* _query_execute(Cursor* self, int multiple, PyObject* args)
} else {
/* sequence */
parameters_iter = PyObject_GetIter(second_argument);
if (!parameters_iter)
{
if (!parameters_iter) {
return NULL;
}
}
......@@ -506,12 +510,7 @@ PyObject* _query_execute(Cursor* self, int multiple, PyObject* args)
/* it's a DDL statement or something similar
- we better COMMIT first so it works for all cases */
if (self->connection->inTransaction) {
func_args = PyTuple_New(0);
if (!func_args) {
goto error;
}
result = connection_commit(self->connection, func_args);
Py_DECREF(func_args);
result = connection_commit(self->connection, NULL);
if (!result) {
goto error;
}
......@@ -701,7 +700,6 @@ PyObject* cursor_executescript(Cursor* self, PyObject* args)
const char* script_cstr;
sqlite3_stmt* statement;
int rc;
PyObject* func_args;
PyObject* result;
int statement_completed = 0;
......@@ -728,12 +726,7 @@ PyObject* cursor_executescript(Cursor* self, PyObject* args)
}
/* commit first */
func_args = PyTuple_New(0);
if (!func_args) {
goto error;
}
result = connection_commit(self->connection, func_args);
Py_DECREF(func_args);
result = connection_commit(self->connection, NULL);
if (!result) {
goto error;
}
......@@ -977,6 +970,9 @@ static struct PyMemberDef cursor_members[] =
{NULL}
};
static char cursor_doc[] =
PyDoc_STR("SQLite database cursor class.");
PyTypeObject CursorType = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
......@@ -999,7 +995,7 @@ PyTypeObject CursorType = {
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_ITER|Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /* tp_doc */
cursor_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
......
/* cursor.h - definitions for the cursor type
*
* Copyright (C) 2004-2005 Gerhard Hring <gh@ghaering.de>
* Copyright (C) 2004-2006 Gerhard Hring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
......
......@@ -54,6 +54,6 @@ extern PyObject *microprotocols_adapt(
extern PyObject *
psyco_microprotocols_adapt(Cursor* self, PyObject *args);
#define psyco_microprotocols_adapt_doc \
"adapt(obj, protocol, alternate) -> adapt obj to given protocol"
"adapt(obj, protocol, alternate) -> adapt obj to given protocol. Non-standard."
#endif /* !defined(PSYCOPG_MICROPROTOCOLS_H) */
......@@ -167,12 +167,12 @@ void converters_init(PyObject* dict)
static PyMethodDef module_methods[] = {
{"connect", (PyCFunction)module_connect, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Creates a connection.")},
{"complete_statement", (PyCFunction)module_complete, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Checks if a string contains a complete SQL statement.")},
{"complete_statement", (PyCFunction)module_complete, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Checks if a string contains a complete SQL statement. Non-standard.")},
#ifdef HAVE_SHARED_CACHE
{"enable_shared_cache", (PyCFunction)module_enable_shared_cache, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Enable or disable shared cache mode for the calling thread.")},
{"enable_shared_cache", (PyCFunction)module_enable_shared_cache, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Enable or disable shared cache mode for the calling thread. Experimental/Non-standard.")},
#endif
{"register_adapter", (PyCFunction)module_register_adapter, METH_VARARGS, PyDoc_STR("Registers an adapter with sqlite's adapter registry.")},
{"register_converter", (PyCFunction)module_register_converter, METH_VARARGS, PyDoc_STR("Registers a converter with sqlite.")},
{"register_adapter", (PyCFunction)module_register_adapter, METH_VARARGS, PyDoc_STR("Registers an adapter with pysqlite's adapter registry. Non-standard.")},
{"register_converter", (PyCFunction)module_register_converter, METH_VARARGS, PyDoc_STR("Registers a converter with pysqlite. Non-standard.")},
{"adapt", (PyCFunction)psyco_microprotocols_adapt, METH_VARARGS, psyco_microprotocols_adapt_doc},
{NULL, NULL}
};
......
/* module.h - definitions for the module
*
* Copyright (C) 2004-2005 Gerhard Häring <gh@ghaering.de>
* Copyright (C) 2004-2006 Gerhard Häring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
......@@ -25,7 +25,7 @@
#define PYSQLITE_MODULE_H
#include "Python.h"
#define PYSQLITE_VERSION "2.2.0"
#define PYSQLITE_VERSION "2.2.2"
extern PyObject* Error;
extern PyObject* Warning;
......
......@@ -64,6 +64,7 @@ int statement_create(Statement* self, Connection* connection, PyObject* sql)
return rc;
}
self->in_weakreflist = NULL;
self->sql = sql_str;
sql_cstr = PyString_AsString(sql_str);
......@@ -304,6 +305,10 @@ void statement_dealloc(Statement* self)
Py_XDECREF(self->sql);
if (self->in_weakreflist != NULL) {
PyObject_ClearWeakRefs((PyObject*)self);
}
self->ob_type->tp_free((PyObject*)self);
}
......@@ -398,12 +403,12 @@ PyTypeObject StatementType = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
offsetof(Statement, in_weakreflist), /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
......
......@@ -38,6 +38,7 @@ typedef struct
sqlite3_stmt* st;
PyObject* sql;
int in_use;
PyObject* in_weakreflist; /* List of weak references */
} Statement;
extern PyTypeObject StatementType;
......
......@@ -250,18 +250,12 @@
<References>
</References>
<Files>
<File
RelativePath="..\Modules\_sqlite\adapters.c">
</File>
<File
RelativePath="..\Modules\_sqlite\cache.c">
</File>
<File
RelativePath="..\Modules\_sqlite\connection.c">
</File>
<File
RelativePath="..\Modules\_sqlite\converters.c">
</File>
<File
RelativePath="..\Modules\_sqlite\cursor.c">
</File>
......
......@@ -743,10 +743,8 @@ class PyBuildExt(build_ext):
sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
if sqlite_incdir and sqlite_libdir:
sqlite_srcs = ['_sqlite/adapters.c',
'_sqlite/cache.c',
sqlite_srcs = ['_sqlite/cache.c',
'_sqlite/connection.c',
'_sqlite/converters.c',
'_sqlite/cursor.c',
'_sqlite/microprotocols.c',
'_sqlite/module.c',
......@@ -755,18 +753,12 @@ class PyBuildExt(build_ext):
'_sqlite/statement.c',
'_sqlite/util.c', ]
PYSQLITE_VERSION = "2.2.0"
sqlite_defines = []
if sys.platform != "win32":
sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
else:
sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
sqlite_defines.append(('PY_MAJOR_VERSION',
str(sys.version_info[0])))
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",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment