Internal imports simplified.

.c files only need to import psycopg.h: it will in turn import
dependencies from Python and libpq and configure.h. psycopg.h should be
the first to be imported, so the basic imports are not required in
the .h's

As a guideline I'm trying to import from the most specific to the most
generic to detect missing imports in the .h's.
This commit is contained in:
Daniele Varrazzo 2010-12-12 10:55:19 +00:00
parent 9fa1eac2b4
commit 6d7916cfe1
45 changed files with 116 additions and 263 deletions

View File

@ -22,19 +22,17 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
#include "psycopg/adapter_asis.h"
#include "psycopg/microprotocols_proto.h"
#include <structmember.h>
#include <stringobject.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/adapter_asis.h"
#include "psycopg/microprotocols_proto.h"
/** the AsIs object **/

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_ASIS_H
#define PSYCOPG_ASIS_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,21 +23,17 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>
#include <stringobject.h>
#include <libpq-fe.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/connection.h"
#include "psycopg/adapter_binary.h"
#include "psycopg/microprotocols_proto.h"
#include "psycopg/connection.h"
#include <structmember.h>
#include <stringobject.h>
#include <string.h>
/** the quoting code */

View File

@ -26,12 +26,6 @@
#ifndef PSYCOPG_BINARY_H
#define PSYCOPG_BINARY_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <libpq-fe.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,8 +23,12 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
#include "psycopg/adapter_datetime.h"
#include "psycopg/microprotocols_proto.h"
#include <structmember.h>
#include <stringobject.h>
#include <datetime.h>
@ -32,12 +36,6 @@
#include <time.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/adapter_datetime.h"
#include "psycopg/microprotocols_proto.h"
extern HIDDEN PyObject *pyPsycopgTzModule;
extern HIDDEN PyObject *pyPsycopgTzLOCAL;

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_DATETIME_H
#define PSYCOPG_DATETIME_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,19 +23,16 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>
#include <stringobject.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/adapter_list.h"
#include "psycopg/microprotocols.h"
#include "psycopg/microprotocols_proto.h"
#include <structmember.h>
#include <stringobject.h>
/* list_str, list_getquoted - return result of quoting */

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_LIST_H
#define PSYCOPG_LIST_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,19 +23,18 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
/* TODO: check if still compiles ok: I have no mx on this box */
#include "psycopg/adapter_mxdatetime.h"
#include "psycopg/microprotocols_proto.h"
#include <structmember.h>
#include <stringobject.h>
#include <mxDateTime.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/adapter_mxdatetime.h"
#include "psycopg/microprotocols_proto.h"
int
psyco_adapter_mxdatetime_init(void)

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_MXDATETIME_H
#define PSYCOPG_MXDATETIME_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,19 +23,16 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
#include "psycopg/adapter_pboolean.h"
#include "psycopg/microprotocols_proto.h"
#include <structmember.h>
#include <stringobject.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/adapter_pboolean.h"
#include "psycopg/microprotocols_proto.h"
/** the Boolean object **/

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_PBOOLEAN_H
#define PSYCOPG_PBOOLEAN_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,19 +23,16 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
#include "psycopg/adapter_pdecimal.h"
#include "psycopg/microprotocols_proto.h"
#include <structmember.h>
#include <floatobject.h>
#include <math.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/adapter_pdecimal.h"
#include "psycopg/microprotocols_proto.h"
/** the Decimal object **/

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_PDECIMAL_H
#define PSYCOPG_PDECIMAL_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,19 +23,16 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
#include "psycopg/adapter_pfloat.h"
#include "psycopg/microprotocols_proto.h"
#include <structmember.h>
#include <floatobject.h>
#include <math.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/adapter_pfloat.h"
#include "psycopg/microprotocols_proto.h"
/** the Float object **/

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_PFLOAT_H
#define PSYCOPG_PFLOAT_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,22 +23,17 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>
#include <stringobject.h>
#include <libpq-fe.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/connection.h"
#include "psycopg/adapter_qstring.h"
#include "psycopg/microprotocols_proto.h"
#include <structmember.h>
#include <stringobject.h>
#include <string.h>
/* qstring_quote - do the quote process on plain and unicode strings */

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_QSTRING_H
#define PSYCOPG_QSTRING_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_CONNECTION_H
#define PSYCOPG_CONNECTION_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <libpq-fe.h>
#include "psycopg/config.h"
#include "psycopg/xid.h"
#ifdef __cplusplus

View File

@ -23,19 +23,18 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/psycopg.h"
#include "psycopg/connection.h"
#include "psycopg/cursor.h"
#include "psycopg/pqpath.h"
#include "psycopg/green.h"
#include "psycopg/notify.h"
#include <string.h>
/* conn_notice_callback - process notices */
static void

View File

@ -23,18 +23,9 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>
#include <stringobject.h>
#include <string.h>
#include <ctype.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/connection.h"
#include "psycopg/cursor.h"
#include "psycopg/pqpath.h"
@ -42,6 +33,13 @@
#include "psycopg/green.h"
#include "psycopg/xid.h"
#include <structmember.h>
#include <stringobject.h>
#include <string.h>
#include <ctype.h>
/** DBAPI methods **/
/* cursor method - allocate a new cursor */

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_CURSOR_H
#define PSYCOPG_CURSOR_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <libpq-fe.h>
#include "psycopg/config.h"
#include "psycopg/connection.h"
#ifdef __cplusplus

View File

@ -23,16 +23,15 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/psycopg.h"
#include "psycopg/cursor.h"
#include "psycopg/pqpath.h"
#include <string.h>
/* curs_reset - reset the cursor to a clean state */
void

View File

@ -23,15 +23,9 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/cursor.h"
#include "psycopg/connection.h"
#include "psycopg/green.h"
@ -39,9 +33,13 @@
#include "psycopg/typecast.h"
#include "psycopg/microprotocols.h"
#include "psycopg/microprotocols_proto.h"
#include "pgversion.h"
#include <structmember.h>
#include <string.h>
#include <stdlib.h>
extern PyObject *pyPsycopgTzFixedOffsetTimezone;

View File

@ -24,13 +24,13 @@
*/
#define PSYCOPG_MODULE
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/config.h"
#include "psycopg/green.h"
#include "psycopg/connection.h"
#include "psycopg/pqpath.h"
HIDDEN PyObject *wait_callback = NULL;
static PyObject *have_wait_callback(void);

View File

@ -26,11 +26,8 @@
#ifndef PSYCOPG_LOBJECT_H
#define PSYCOPG_LOBJECT_H 1
#include <Python.h>
#include <libpq-fe.h>
#include <libpq/libpq-fs.h>
#include "psycopg/config.h"
#include "psycopg/connection.h"
#ifdef __cplusplus

View File

@ -23,17 +23,15 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/psycopg.h"
#include "psycopg/connection.h"
#include "psycopg/lobject.h"
#include "psycopg/connection.h"
#include "psycopg/pqpath.h"
#include <string.h>
#ifdef PSYCOPG_EXTENSIONS
static void

View File

@ -23,20 +23,18 @@
* License for more details.
*/
#include <Python.h>
#include <structmember.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/lobject.h"
#include "psycopg/connection.h"
#include "psycopg/microprotocols.h"
#include "psycopg/microprotocols_proto.h"
#include "psycopg/pqpath.h"
#include <structmember.h>
#include <string.h>
#ifdef PSYCOPG_EXTENSIONS

View File

@ -23,18 +23,15 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/cursor.h"
#include "psycopg/connection.h"
#include "psycopg/microprotocols.h"
#include "psycopg/microprotocols_proto.h"
#include "psycopg/cursor.h"
#include "psycopg/connection.h"
#include <structmember.h>
/** the adapters registry **/

View File

@ -26,9 +26,6 @@
#ifndef PSYCOPG_MICROPROTOCOLS_H
#define PSYCOPG_MICROPROTOCOLS_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#include "psycopg/connection.h"
#include "psycopg/cursor.h"

View File

@ -23,19 +23,16 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
#include "psycopg/microprotocols_proto.h"
#include <structmember.h>
#include <stringobject.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/microprotocols_proto.h"
/** void protocol implementation **/

View File

@ -26,12 +26,6 @@
#ifndef PSYCOPG_ISQLQUOTE_H
#define PSYCOPG_ISQLQUOTE_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <libpq-fe.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -26,10 +26,6 @@
#ifndef PSYCOPG_NOTIFY_H
#define PSYCOPG_NOTIFY_H 1
#include <Python.h>
#include "psycopg/config.h"
extern HIDDEN PyTypeObject NotifyType;
typedef struct {

View File

@ -23,15 +23,13 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
#include "psycopg/notify.h"
#include <structmember.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/notify.h"
static const char notify_doc[] =
"A notification received from the backend.\n\n"

View File

@ -29,14 +29,9 @@
connection.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/pqpath.h"
#include "psycopg/connection.h"
#include "psycopg/cursor.h"
@ -44,6 +39,8 @@
#include "psycopg/typecast.h"
#include "psycopg/pgtypes.h"
#include <string.h>
/* Strip off the severity from a Postgres error message. */
static const char *

View File

@ -26,7 +26,6 @@
#ifndef PSYCOPG_PQPATH_H
#define PSYCOPG_PQPATH_H 1
#include "psycopg/config.h"
#include "psycopg/cursor.h"
#include "psycopg/connection.h"

View File

@ -23,13 +23,9 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/connection.h"
#include "psycopg/cursor.h"
#include "psycopg/green.h"

View File

@ -26,8 +26,6 @@
#ifndef PSYCOPG_PYTHON_H
#define PSYCOPG_PYTHON_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>
#if PY_VERSION_HEX < 0x02040000

View File

@ -23,14 +23,11 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
#include <structmember.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/psycopg.h"
#include "psycopg/python.h"
#include "psycopg/typecast.h"
#include "psycopg/cursor.h"

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_TYPECAST_H
#define PSYCOPG_TYPECAST_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -25,7 +25,6 @@
#include "typecast_binary.h"
#include <libpq-fe.h>
#include <stdlib.h>

View File

@ -26,11 +26,6 @@
#ifndef PSYCOPG_TYPECAST_BINARY_H
#define PSYCOPG_TYPECAST_BINARY_H 1
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "psycopg/config.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,14 +23,13 @@
* License for more details.
*/
#include <Python.h>
#include <string.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/psycopg.h"
#include "psycopg/connection.h"
#include "psycopg/pgtypes.h"
#include <string.h>
#include <stdlib.h>
char *

View File

@ -27,10 +27,6 @@
#ifndef PSYCOPG_XID_H
#define PSYCOPG_XID_H 1
#include <Python.h>
#include "psycopg/config.h"
extern HIDDEN PyTypeObject XidType;
typedef struct {

View File

@ -24,15 +24,13 @@
* License for more details.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
#include "psycopg/xid.h"
#include <structmember.h>
#define PSYCOPG_MODULE
#include "psycopg/config.h"
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/xid.h"
static const char xid_doc[] =
"A transaction identifier used for two-phase commit.\n\n"