Dropped PSYCOPG_EXTENSIONS flag

Building without extensions has been long broken and nobody really cares
about a pure-DBAPI implementation (which could be created using a wrapper
instead).
This commit is contained in:
Daniele Varrazzo 2014-08-23 19:30:48 +01:00
parent 6a5f778361
commit 6e841a41e6
10 changed files with 2 additions and 69 deletions

View File

@ -442,9 +442,6 @@ exit:
} }
#ifdef PSYCOPG_EXTENSIONS
/* parse a python object into one of the possible isolation level values */ /* parse a python object into one of the possible isolation level values */
extern const IsolationLevel conn_isolevels[]; extern const IsolationLevel conn_isolevels[];
@ -860,8 +857,6 @@ psyco_conn_poll(connectionObject *self)
} }
/* extension: fileno - return the file descriptor of the connection */
#define psyco_conn_fileno_doc \ #define psyco_conn_fileno_doc \
"fileno() -> int -- Return file descriptor associated to database connection." "fileno() -> int -- Return file descriptor associated to database connection."
@ -878,8 +873,6 @@ psyco_conn_fileno(connectionObject *self)
} }
/* extension: isexecuting - check for asynchronous operations */
#define psyco_conn_isexecuting_doc \ #define psyco_conn_isexecuting_doc \
"isexecuting() -> bool -- Return True if the connection is " \ "isexecuting() -> bool -- Return True if the connection is " \
"executing an asynchronous operation." "executing an asynchronous operation."
@ -911,8 +904,6 @@ psyco_conn_isexecuting(connectionObject *self)
} }
/* extension: cancel - cancel the current operation */
#define psyco_conn_cancel_doc \ #define psyco_conn_cancel_doc \
"cancel() -- cancel the current operation" "cancel() -- cancel the current operation"
@ -941,8 +932,6 @@ psyco_conn_cancel(connectionObject *self)
Py_RETURN_NONE; Py_RETURN_NONE;
} }
#endif /* PSYCOPG_EXTENSIONS */
/** the connection object **/ /** the connection object **/
@ -974,7 +963,6 @@ static struct PyMethodDef connectionObject_methods[] = {
METH_NOARGS, psyco_conn_enter_doc}, METH_NOARGS, psyco_conn_enter_doc},
{"__exit__", (PyCFunction)psyco_conn_exit, {"__exit__", (PyCFunction)psyco_conn_exit,
METH_VARARGS, psyco_conn_exit_doc}, METH_VARARGS, psyco_conn_exit_doc},
#ifdef PSYCOPG_EXTENSIONS
{"set_session", (PyCFunction)psyco_conn_set_session, {"set_session", (PyCFunction)psyco_conn_set_session,
METH_VARARGS|METH_KEYWORDS, psyco_conn_set_session_doc}, METH_VARARGS|METH_KEYWORDS, psyco_conn_set_session_doc},
{"set_isolation_level", (PyCFunction)psyco_conn_set_isolation_level, {"set_isolation_level", (PyCFunction)psyco_conn_set_isolation_level,
@ -999,14 +987,12 @@ static struct PyMethodDef connectionObject_methods[] = {
METH_NOARGS, psyco_conn_isexecuting_doc}, METH_NOARGS, psyco_conn_isexecuting_doc},
{"cancel", (PyCFunction)psyco_conn_cancel, {"cancel", (PyCFunction)psyco_conn_cancel,
METH_NOARGS, psyco_conn_cancel_doc}, METH_NOARGS, psyco_conn_cancel_doc},
#endif
{NULL} {NULL}
}; };
/* object member list */ /* object member list */
static struct PyMemberDef connectionObject_members[] = { static struct PyMemberDef connectionObject_members[] = {
#ifdef PSYCOPG_EXTENSIONS
{"closed", T_LONG, offsetof(connectionObject, closed), READONLY, {"closed", T_LONG, offsetof(connectionObject, closed), READONLY,
"True if the connection is closed."}, "True if the connection is closed."},
{"encoding", T_STRING, offsetof(connectionObject, encoding), READONLY, {"encoding", T_STRING, offsetof(connectionObject, encoding), READONLY,
@ -1032,7 +1018,6 @@ static struct PyMemberDef connectionObject_members[] = {
{"server_version", T_INT, {"server_version", T_INT,
offsetof(connectionObject, server_version), READONLY, offsetof(connectionObject, server_version), READONLY,
"Server version."}, "Server version."},
#endif
{NULL} {NULL}
}; };
@ -1040,7 +1025,6 @@ static struct PyMemberDef connectionObject_members[] = {
{ #exc, psyco_conn_get_exception, NULL, exc ## _doc, &exc } { #exc, psyco_conn_get_exception, NULL, exc ## _doc, &exc }
static struct PyGetSetDef connectionObject_getsets[] = { static struct PyGetSetDef connectionObject_getsets[] = {
/* DBAPI-2.0 extensions (exception objects) */
EXCEPTION_GETTER(Error), EXCEPTION_GETTER(Error),
EXCEPTION_GETTER(Warning), EXCEPTION_GETTER(Warning),
EXCEPTION_GETTER(InterfaceError), EXCEPTION_GETTER(InterfaceError),
@ -1051,7 +1035,6 @@ static struct PyGetSetDef connectionObject_getsets[] = {
EXCEPTION_GETTER(IntegrityError), EXCEPTION_GETTER(IntegrityError),
EXCEPTION_GETTER(DataError), EXCEPTION_GETTER(DataError),
EXCEPTION_GETTER(NotSupportedError), EXCEPTION_GETTER(NotSupportedError),
#ifdef PSYCOPG_EXTENSIONS
{ "autocommit", { "autocommit",
(getter)psyco_conn_autocommit_get, (getter)psyco_conn_autocommit_get,
(setter)psyco_conn_autocommit_set, (setter)psyco_conn_autocommit_set,
@ -1060,7 +1043,6 @@ static struct PyGetSetDef connectionObject_getsets[] = {
(getter)psyco_conn_isolation_level_get, (getter)psyco_conn_isolation_level_get,
(setter)NULL, (setter)NULL,
"The current isolation level." }, "The current isolation level." },
#endif
{NULL} {NULL}
}; };
#undef EXCEPTION_GETTER #undef EXCEPTION_GETTER

View File

@ -559,7 +559,6 @@ psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs)
} }
#ifdef PSYCOPG_EXTENSIONS
#define psyco_curs_mogrify_doc \ #define psyco_curs_mogrify_doc \
"mogrify(query, vars=None) -> str -- Return query after vars binding." "mogrify(query, vars=None) -> str -- Return query after vars binding."
@ -622,7 +621,6 @@ psyco_curs_mogrify(cursorObject *self, PyObject *args, PyObject *kwargs)
return _psyco_curs_mogrify(self, operation, vars); return _psyco_curs_mogrify(self, operation, vars);
} }
#endif
/* cast method - convert an oid/string into a Python object */ /* cast method - convert an oid/string into a Python object */
@ -1222,8 +1220,6 @@ exit:
} }
#ifdef PSYCOPG_EXTENSIONS
/* Return a newly allocated buffer containing the list of columns to be /* Return a newly allocated buffer containing the list of columns to be
* copied. On error return NULL and set an exception. * copied. On error return NULL and set an exception.
*/ */
@ -1669,8 +1665,6 @@ psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue)
return 0; return 0;
} }
#endif
/** the cursor object **/ /** the cursor object **/
@ -1738,7 +1732,6 @@ static struct PyMethodDef cursorObject_methods[] = {
{"__exit__", (PyCFunction)psyco_curs_exit, {"__exit__", (PyCFunction)psyco_curs_exit,
METH_VARARGS, psyco_curs_exit_doc}, METH_VARARGS, psyco_curs_exit_doc},
/* psycopg extensions */ /* psycopg extensions */
#ifdef PSYCOPG_EXTENSIONS
{"cast", (PyCFunction)psyco_curs_cast, {"cast", (PyCFunction)psyco_curs_cast,
METH_VARARGS, psyco_curs_cast_doc}, METH_VARARGS, psyco_curs_cast_doc},
{"mogrify", (PyCFunction)psyco_curs_mogrify, {"mogrify", (PyCFunction)psyco_curs_mogrify,
@ -1749,7 +1742,6 @@ static struct PyMethodDef cursorObject_methods[] = {
METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_to_doc}, METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_to_doc},
{"copy_expert", (PyCFunction)psyco_curs_copy_expert, {"copy_expert", (PyCFunction)psyco_curs_copy_expert,
METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_expert_doc}, METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_expert_doc},
#endif
{NULL} {NULL}
}; };
@ -1775,7 +1767,6 @@ static struct PyMemberDef cursorObject_members[] = {
"The current row position."}, "The current row position."},
{"connection", T_OBJECT, OFFSETOF(conn), READONLY, {"connection", T_OBJECT, OFFSETOF(conn), READONLY,
"The connection where the cursor comes from."}, "The connection where the cursor comes from."},
#ifdef PSYCOPG_EXTENSIONS
{"name", T_STRING, OFFSETOF(name), READONLY}, {"name", T_STRING, OFFSETOF(name), READONLY},
{"statusmessage", T_OBJECT, OFFSETOF(pgstatus), READONLY, {"statusmessage", T_OBJECT, OFFSETOF(pgstatus), READONLY,
"The return message of the last command."}, "The return message of the last command."},
@ -1786,13 +1777,11 @@ static struct PyMemberDef cursorObject_members[] = {
{"typecaster", T_OBJECT, OFFSETOF(caster), READONLY}, {"typecaster", T_OBJECT, OFFSETOF(caster), READONLY},
{"string_types", T_OBJECT, OFFSETOF(string_types), 0}, {"string_types", T_OBJECT, OFFSETOF(string_types), 0},
{"binary_types", T_OBJECT, OFFSETOF(binary_types), 0}, {"binary_types", T_OBJECT, OFFSETOF(binary_types), 0},
#endif
{NULL} {NULL}
}; };
/* object calculated member list */ /* object calculated member list */
static struct PyGetSetDef cursorObject_getsets[] = { static struct PyGetSetDef cursorObject_getsets[] = {
#ifdef PSYCOPG_EXTENSIONS
{ "closed", (getter)psyco_curs_get_closed, NULL, { "closed", (getter)psyco_curs_get_closed, NULL,
psyco_curs_closed_doc, NULL }, psyco_curs_closed_doc, NULL },
{ "withhold", { "withhold",
@ -1803,7 +1792,6 @@ static struct PyGetSetDef cursorObject_getsets[] = {
(getter)psyco_curs_scrollable_get, (getter)psyco_curs_scrollable_get,
(setter)psyco_curs_scrollable_set, (setter)psyco_curs_scrollable_set,
psyco_curs_scrollable_doc, NULL }, psyco_curs_scrollable_doc, NULL },
#endif
{NULL} {NULL}
}; };

View File

@ -80,11 +80,7 @@ psyco_get_wait_callback(PyObject *self, PyObject *obj)
int int
psyco_green() psyco_green()
{ {
#ifdef PSYCOPG_EXTENSIONS
return (NULL != wait_callback); return (NULL != wait_callback);
#else
return 0;
#endif
} }
/* Return the wait callback if available. /* Return the wait callback if available.

View File

@ -32,8 +32,6 @@
#include <string.h> #include <string.h>
#ifdef PSYCOPG_EXTENSIONS
static void static void
collect_error(connectionObject *conn, char **error) collect_error(connectionObject *conn, char **error)
{ {
@ -490,6 +488,3 @@ lobject_truncate(lobjectObject *self, size_t len)
} }
#endif /* PG_VERSION_HEX >= 0x080300 */ #endif /* PG_VERSION_HEX >= 0x080300 */
#endif

View File

@ -35,8 +35,6 @@
#include <string.h> #include <string.h>
#ifdef PSYCOPG_EXTENSIONS
/** public methods **/ /** public methods **/
/* close method - close the lobject */ /* close method - close the lobject */
@ -272,8 +270,6 @@ psyco_lobj_truncate(lobjectObject *self, PyObject *args)
Py_RETURN_NONE; Py_RETURN_NONE;
} }
#endif /* PG_VERSION_HEX >= 0x080300 */
/** the lobject object **/ /** the lobject object **/

View File

@ -113,11 +113,7 @@ exception_from_sqlstate(const char *sqlstate)
case '4': case '4':
switch (sqlstate[1]) { switch (sqlstate[1]) {
case '0': /* Class 40 - Transaction Rollback */ case '0': /* Class 40 - Transaction Rollback */
#ifdef PSYCOPG_EXTENSIONS
return TransactionRollbackError; return TransactionRollbackError;
#else
return OperationalError;
#endif
case '2': /* Class 42 - Syntax Error or Access Rule Violation */ case '2': /* Class 42 - Syntax Error or Access Rule Violation */
case '4': /* Class 44 - WITH CHECK OPTION Violation */ case '4': /* Class 44 - WITH CHECK OPTION Violation */
return ProgrammingError; return ProgrammingError;
@ -129,11 +125,9 @@ exception_from_sqlstate(const char *sqlstate)
Class 55 - Object Not In Prerequisite State Class 55 - Object Not In Prerequisite State
Class 57 - Operator Intervention Class 57 - Operator Intervention
Class 58 - System Error (errors external to PostgreSQL itself) */ Class 58 - System Error (errors external to PostgreSQL itself) */
#ifdef PSYCOPG_EXTENSIONS
if (!strcmp(sqlstate, "57014")) if (!strcmp(sqlstate, "57014"))
return QueryCanceledError; return QueryCanceledError;
else else
#endif
return OperationalError; return OperationalError;
case 'F': /* Class F0 - Configuration File Error */ case 'F': /* Class F0 - Configuration File Error */
return InternalError; return InternalError;

View File

@ -63,9 +63,7 @@ HIDDEN psyco_errors_set_RETURN psyco_errors_set psyco_errors_set_PROTO;
extern HIDDEN PyObject *Error, *Warning, *InterfaceError, *DatabaseError, extern HIDDEN PyObject *Error, *Warning, *InterfaceError, *DatabaseError,
*InternalError, *OperationalError, *ProgrammingError, *InternalError, *OperationalError, *ProgrammingError,
*IntegrityError, *DataError, *NotSupportedError; *IntegrityError, *DataError, *NotSupportedError;
#ifdef PSYCOPG_EXTENSIONS
extern HIDDEN PyObject *QueryCanceledError, *TransactionRollbackError; extern HIDDEN PyObject *QueryCanceledError, *TransactionRollbackError;
#endif
/* python versions and compatibility stuff */ /* python versions and compatibility stuff */
#ifndef PyMODINIT_FUNC #ifndef PyMODINIT_FUNC
@ -164,13 +162,11 @@ STEALS(1) HIDDEN PyObject * psycopg_ensure_text(PyObject *obj);
#define NotSupportedError_doc \ #define NotSupportedError_doc \
"A method or database API was used which is not supported by the database." "A method or database API was used which is not supported by the database."
#ifdef PSYCOPG_EXTENSIONS
#define QueryCanceledError_doc \ #define QueryCanceledError_doc \
"Error related to SQL query cancellation." "Error related to SQL query cancellation."
#define TransactionRollbackError_doc \ #define TransactionRollbackError_doc \
"Error causing transaction rollback (deadlocks, serialization failures, etc)." "Error causing transaction rollback (deadlocks, serialization failures, etc)."
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -398,9 +398,7 @@ exit:
PyObject *Error, *Warning, *InterfaceError, *DatabaseError, PyObject *Error, *Warning, *InterfaceError, *DatabaseError,
*InternalError, *OperationalError, *ProgrammingError, *InternalError, *OperationalError, *ProgrammingError,
*IntegrityError, *DataError, *NotSupportedError; *IntegrityError, *DataError, *NotSupportedError;
#ifdef PSYCOPG_EXTENSIONS
PyObject *QueryCanceledError, *TransactionRollbackError; PyObject *QueryCanceledError, *TransactionRollbackError;
#endif
/* mapping between exception names and their PyObject */ /* mapping between exception names and their PyObject */
static struct { static struct {
@ -423,13 +421,11 @@ static struct {
{ "psycopg2.DataError", &DataError, &DatabaseError, DataError_doc }, { "psycopg2.DataError", &DataError, &DatabaseError, DataError_doc },
{ "psycopg2.NotSupportedError", &NotSupportedError, &DatabaseError, { "psycopg2.NotSupportedError", &NotSupportedError, &DatabaseError,
NotSupportedError_doc }, NotSupportedError_doc },
#ifdef PSYCOPG_EXTENSIONS
{ "psycopg2.extensions.QueryCanceledError", &QueryCanceledError, { "psycopg2.extensions.QueryCanceledError", &QueryCanceledError,
&OperationalError, QueryCanceledError_doc }, &OperationalError, QueryCanceledError_doc },
{ "psycopg2.extensions.TransactionRollbackError", { "psycopg2.extensions.TransactionRollbackError",
&TransactionRollbackError, &OperationalError, &TransactionRollbackError, &OperationalError,
TransactionRollbackError_doc }, TransactionRollbackError_doc },
#endif
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
@ -712,12 +708,10 @@ static PyMethodDef psycopgMethods[] = {
METH_VARARGS, psyco_IntervalFromMx_doc}, METH_VARARGS, psyco_IntervalFromMx_doc},
#endif #endif
#ifdef PSYCOPG_EXTENSIONS
{"set_wait_callback", (PyCFunction)psyco_set_wait_callback, {"set_wait_callback", (PyCFunction)psyco_set_wait_callback,
METH_O, psyco_set_wait_callback_doc}, METH_O, psyco_set_wait_callback_doc},
{"get_wait_callback", (PyCFunction)psyco_get_wait_callback, {"get_wait_callback", (PyCFunction)psyco_get_wait_callback,
METH_NOARGS, psyco_get_wait_callback_doc}, METH_NOARGS, psyco_get_wait_callback_doc},
#endif
{NULL, NULL, 0, NULL} /* Sentinel */ {NULL, NULL, 0, NULL} /* Sentinel */
}; };
@ -806,10 +800,8 @@ INIT_MODULE(_psycopg)(void)
Py_TYPE(&diagnosticsType) = &PyType_Type; Py_TYPE(&diagnosticsType) = &PyType_Type;
if (PyType_Ready(&diagnosticsType) == -1) goto exit; if (PyType_Ready(&diagnosticsType) == -1) goto exit;
#ifdef PSYCOPG_EXTENSIONS
Py_TYPE(&lobjectType) = &PyType_Type; Py_TYPE(&lobjectType) = &PyType_Type;
if (PyType_Ready(&lobjectType) == -1) goto exit; if (PyType_Ready(&lobjectType) == -1) goto exit;
#endif
/* import mx.DateTime module, if necessary */ /* import mx.DateTime module, if necessary */
#ifdef HAVE_MXDATETIME #ifdef HAVE_MXDATETIME
@ -904,9 +896,7 @@ INIT_MODULE(_psycopg)(void)
PyModule_AddObject(module, "Float", (PyObject*)&pfloatType); PyModule_AddObject(module, "Float", (PyObject*)&pfloatType);
PyModule_AddObject(module, "List", (PyObject*)&listType); PyModule_AddObject(module, "List", (PyObject*)&listType);
PyModule_AddObject(module, "QuotedString", (PyObject*)&qstringType); PyModule_AddObject(module, "QuotedString", (PyObject*)&qstringType);
#ifdef PSYCOPG_EXTENSIONS
PyModule_AddObject(module, "lobject", (PyObject*)&lobjectType); PyModule_AddObject(module, "lobject", (PyObject*)&lobjectType);
#endif
/* encodings dictionary in module dictionary */ /* encodings dictionary in module dictionary */
PyModule_AddObject(module, "encodings", psycoEncodings); PyModule_AddObject(module, "encodings", psycoEncodings);

View File

@ -1,7 +1,6 @@
[build_ext] [build_ext]
define=PSYCOPG_EXTENSIONS,PSYCOPG_NEW_BOOLEAN,HAVE_PQFREEMEM define=PSYCOPG_NEW_BOOLEAN,HAVE_PQFREEMEM
# PSYCOPG_EXTENSIONS enables extensions to PEP-249 (you really want this)
# PSYCOPG_DISPLAY_SIZE enable display size calculation (a little slower) # PSYCOPG_DISPLAY_SIZE enable display size calculation (a little slower)
# HAVE_PQFREEMEM should be defined on PostgreSQL >= 7.4 # HAVE_PQFREEMEM should be defined on PostgreSQL >= 7.4
# PSYCOPG_DEBUG can be added to enable verbose debug information # PSYCOPG_DEBUG can be added to enable verbose debug information

View File

@ -511,10 +511,7 @@ you probably need to install its companion -dev or -devel package."""
# generate a nice version string to avoid confusion when users report bugs # generate a nice version string to avoid confusion when users report bugs
version_flags.append('pq3') # no more a choice version_flags.append('pq3') # no more a choice
version_flags.append('ext') # no more a choice
for have in parser.get('build_ext', 'define').split(','):
if have == 'PSYCOPG_EXTENSIONS':
version_flags.append('ext')
if version_flags: if version_flags:
PSYCOPG_VERSION_EX = PSYCOPG_VERSION + " (%s)" % ' '.join(version_flags) PSYCOPG_VERSION_EX = PSYCOPG_VERSION + " (%s)" % ' '.join(version_flags)