From 288f9ee80922ef4ae63b463f8c75c9a689dfcc46 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 4 Dec 2010 10:26:49 +0000 Subject: [PATCH] Work around CentOS 5.5 x86_64 buld problem. Closes ticket #23 --- ChangeLog | 3 +++ NEWS-2.3 | 6 +++++ psycopg/psycopgmodule.c | 4 ---- psycopg/typecast.c | 3 +++ psycopg/typecast_datetime.c | 2 +- psycopg/typecast_datetime.h | 44 ----------------------------------- psycopg/typecast_mxdatetime.c | 2 +- psycopg/typecast_mxdatetime.h | 44 ----------------------------------- 8 files changed, 14 insertions(+), 94 deletions(-) delete mode 100644 psycopg/typecast_datetime.h delete mode 100644 psycopg/typecast_mxdatetime.h diff --git a/ChangeLog b/ChangeLog index 5de3c88a..7c169584 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * setup.py: bumped to version 2.3.1.dev0 + * datetime modules reorganized to work around CentOS 5.5 x86_64 buld + problem. Closes ticket #23 + 2010-12-01 Daniele Varrazzo * lib/extras.py: DictRow items can be updated. Patch by Alex Aster. diff --git a/NEWS-2.3 b/NEWS-2.3 index b0b3c3d2..d8208d9b 100644 --- a/NEWS-2.3 +++ b/NEWS-2.3 @@ -1,3 +1,9 @@ +What's new in psycopg 2.3.1 +--------------------------- + + - Fixed build problem on CentOS 5.5 x86_64 (ticket #23). + + What's new in psycopg 2.3.0 --------------------------- diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index d0a77351..db44807f 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -48,12 +48,10 @@ #include "psycopg/adapter_asis.h" #include "psycopg/adapter_list.h" #include "psycopg/typecast_binary.h" -#include "psycopg/typecast_datetime.h" #ifdef HAVE_MXDATETIME #include #include "psycopg/adapter_mxdatetime.h" -#include "psycopg/typecast_mxdatetime.h" #endif /* some module-level variables, like the datetime module */ @@ -764,7 +762,6 @@ init_psycopg(void) return; } if (psyco_adapter_mxdatetime_init()) { return; } - if (psyco_typecast_mxdatetime_init()) { return; } #endif /* import python builtin datetime module, if available */ @@ -778,7 +775,6 @@ init_psycopg(void) /* Initialize the PyDateTimeAPI everywhere is used */ PyDateTime_IMPORT; if (psyco_adapter_datetime_init()) { return; } - if (psyco_typecast_datetime_init()) { return; } pydatetimeType.ob_type = &PyType_Type; if (PyType_Ready(&pydatetimeType) == -1) return; diff --git a/psycopg/typecast.c b/psycopg/typecast.c index 8eab1eb7..2e016cf9 100644 --- a/psycopg/typecast.c +++ b/psycopg/typecast.c @@ -277,6 +277,7 @@ typecast_init(PyObject *dict) /* register the date/time typecasters with their original names */ #ifdef HAVE_MXDATETIME + if (psyco_typecast_mxdatetime_init()) { return -1; } for (i = 0; typecast_mxdatetime[i].name != NULL; i++) { typecastObject *t; Dprintf("typecast_init: initializing %s", typecast_mxdatetime[i].name); @@ -285,6 +286,8 @@ typecast_init(PyObject *dict) PyDict_SetItem(dict, t->name, (PyObject *)t); } #endif + + if (psyco_typecast_datetime_init()) { return -1; } for (i = 0; typecast_pydatetime[i].name != NULL; i++) { typecastObject *t; Dprintf("typecast_init: initializing %s", typecast_pydatetime[i].name); diff --git a/psycopg/typecast_datetime.c b/psycopg/typecast_datetime.c index 871965bd..2bc3625e 100644 --- a/psycopg/typecast_datetime.c +++ b/psycopg/typecast_datetime.c @@ -26,7 +26,7 @@ #include #include "datetime.h" -int +static int psyco_typecast_datetime_init(void) { Dprintf("psyco_typecast_datetime_init: datetime init"); diff --git a/psycopg/typecast_datetime.h b/psycopg/typecast_datetime.h deleted file mode 100644 index cb01c6f0..00000000 --- a/psycopg/typecast_datetime.h +++ /dev/null @@ -1,44 +0,0 @@ -/* typecast_datetime.h - definitions for datetime objects typecasters - * - * Copyright (C) 2010 Daniele Varrazzo - * - * This file is part of psycopg. - * - * psycopg2 is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition, as a special exception, the copyright holders give - * permission to link this program with the OpenSSL library (or with - * modified versions of OpenSSL that use the same license as OpenSSL), - * and distribute linked combinations including the two. - * - * You must obey the GNU Lesser General Public License in all respects for - * all of the code used other than OpenSSL. - * - * psycopg2 is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - */ - -#ifndef PSYCOPG_TYPECAST_DATETIME_H -#define PSYCOPG_TYPECAST_DATETIME_H 1 - -#define PY_SSIZE_T_CLEAN -#include - -#include "psycopg/config.h" - -#ifdef __cplusplus -extern "C" { -#endif - -HIDDEN int psyco_typecast_datetime_init(void); - -#ifdef __cplusplus -} -#endif - -#endif /* !defined(PSYCOPG_TYPECAST_DATETIME_H) */ diff --git a/psycopg/typecast_mxdatetime.c b/psycopg/typecast_mxdatetime.c index a0c8b5b4..a3a95fa6 100644 --- a/psycopg/typecast_mxdatetime.c +++ b/psycopg/typecast_mxdatetime.c @@ -25,7 +25,7 @@ #include "mxDateTime.h" -int +static int psyco_typecast_mxdatetime_init(void) { Dprintf("psyco_typecast_mxdatetime_init: mx.DateTime init"); diff --git a/psycopg/typecast_mxdatetime.h b/psycopg/typecast_mxdatetime.h deleted file mode 100644 index 2c14f81d..00000000 --- a/psycopg/typecast_mxdatetime.h +++ /dev/null @@ -1,44 +0,0 @@ -/* typecast_mxdatetime.h - definitions for mx.DateTime typecasters - * - * Copyright (C) 2010 Daniele Varrazzo - * - * This file is part of psycopg. - * - * psycopg2 is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition, as a special exception, the copyright holders give - * permission to link this program with the OpenSSL library (or with - * modified versions of OpenSSL that use the same license as OpenSSL), - * and distribute linked combinations including the two. - * - * You must obey the GNU Lesser General Public License in all respects for - * all of the code used other than OpenSSL. - * - * psycopg2 is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - */ - -#ifndef PSYCOPG_TYPECAST_MXDATETIME_H -#define PSYCOPG_TYPECAST_MXDATETIME_H 1 - -#define PY_SSIZE_T_CLEAN -#include - -#include "psycopg/config.h" - -#ifdef __cplusplus -extern "C" { -#endif - -HIDDEN int psyco_typecast_mxdatetime_init(void); - -#ifdef __cplusplus -} -#endif - -#endif /* !defined(PSYCOPG_TYPECAST_MXDATETIME_H) */