rpms/rrdtool/F-9 rrdtool-1.3rc4-fix-python-bindings.patch, NONE, 1.1 rrdtool.spec, 1.60, 1.61
Chris Ricker (kaboom)
fedora-extras-commits at redhat.com
Tue May 20 01:55:44 UTC 2008
- Previous message (by thread): rpms/scim-array/devel .cvsignore, 1.5, 1.6 scim-array.spec, 1.8, 1.9 sources, 1.6, 1.7
- Next message (by thread): rpms/rrdtool/F-8 rrdtool-1.3rc4-fix-python-bindings.patch, NONE, 1.1 rrdtool.spec, 1.51, 1.52
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: kaboom
Update of /cvs/pkgs/rpms/rrdtool/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22697
Modified Files:
rrdtool.spec
Added Files:
rrdtool-1.3rc4-fix-python-bindings.patch
Log Message:
Patch python bindings
rrdtool-1.3rc4-fix-python-bindings.patch:
--- NEW FILE rrdtool-1.3rc4-fix-python-bindings.patch ---
Index: rrdtool/bindings/python/rrdtoolmodule.c
===================================================================
--- rrdtool/bindings/python/rrdtoolmodule.c (revision 1345)
+++ rrdtool/bindings/python/rrdtoolmodule.c (revision 1372)
@@ -41,6 +41,7 @@
#include "Python.h"
-#include "rrd.h"
-#include "rrd_extra.h"
+#include "../../src/rrd_tool.h"
+//#include "rrd.h"
+//#include "rrd_extra.h"
static PyObject *ErrorObject;
@@ -403,4 +404,38 @@
}
+static PyObject *PyDict_FromInfo(
+ info_t *data)
+{
+ PyObject *r;
+ r = PyDict_New();
+ while (data){
+ PyObject *val = NULL;
+ switch (data->type) {
+ case RD_I_VAL:
+ val = isnan(data->value.u_val)
+ ? (Py_INCREF(Py_None), Py_None)
+ : PyFloat_FromDouble(data->value.u_val);
+ break;
+ case RD_I_CNT:
+ val = PyLong_FromUnsignedLong(data->value.u_cnt);
+ break;
+ case RD_I_INT:
+ val = PyLong_FromLong(data->value.u_int);
+ break;
+ case RD_I_STR:
+ val = PyString_FromString(data->value.u_str);
+ break;
+ case RD_I_BLO:
+ val = PyString_FromStringAndSize((char*)data->value.u_blo.ptr, data->value.u_blo.size);
+ break;
+ }
+ if (val){
+ PyDict_SetItemString(r,data->key,val);
+ }
+ data = data->next;
+ }
+ return r;
+}
+
static char PyRRD_info__doc__[] =
"info(filename): extract header information from an rrd";
@@ -410,99 +445,69 @@
PyObject * args)
{
- PyObject *r, *t, *ds;
- rrd_t rrd;
- char *filename;
- unsigned long i, j;
-
- if (!PyArg_ParseTuple(args, "s:info", &filename))
- return NULL;
-
- if (!rrd_open(filename, &rrd, RRD_READONLY) == -1) {
- PyErr_SetString(ErrorObject, rrd_get_error());
- rrd_clear_error();
- return NULL;
- }
-#define DICTSET_STR(dict, name, value) \
- t = PyString_FromString(value); \
- PyDict_SetItemString(dict, name, t); \
- Py_DECREF(t);
-
-#define DICTSET_CNT(dict, name, value) \
- t = PyInt_FromLong((long)value); \
- PyDict_SetItemString(dict, name, t); \
- Py_DECREF(t);
-
-#define DICTSET_VAL(dict, name, value) \
- t = isnan(value) ? (Py_INCREF(Py_None), Py_None) : \
- PyFloat_FromDouble((double)value); \
- PyDict_SetItemString(dict, name, t); \
- Py_DECREF(t);
-
- r = PyDict_New();
-
- DICTSET_STR(r, "filename", filename);
- DICTSET_STR(r, "rrd_version", rrd.stat_head->version);
- DICTSET_CNT(r, "step", rrd.stat_head->pdp_step);
- DICTSET_CNT(r, "last_update", rrd.live_head->last_up);
-
- ds = PyDict_New();
- PyDict_SetItemString(r, "ds", ds);
- Py_DECREF(ds);
-
- for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
- PyObject *d;
-
- d = PyDict_New();
- PyDict_SetItemString(ds, rrd.ds_def[i].ds_nam, d);
- Py_DECREF(d);
-
- DICTSET_STR(d, "ds_name", rrd.ds_def[i].ds_nam);
- DICTSET_STR(d, "type", rrd.ds_def[i].dst);
- DICTSET_CNT(d, "minimal_heartbeat",
- rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
- DICTSET_VAL(d, "min", rrd.ds_def[i].par[DS_min_val].u_val);
- DICTSET_VAL(d, "max", rrd.ds_def[i].par[DS_max_val].u_val);
- DICTSET_STR(d, "last_ds", rrd.pdp_prep[i].last_ds);
- DICTSET_VAL(d, "value", rrd.pdp_prep[i].scratch[PDP_val].u_val);
- DICTSET_CNT(d, "unknown_sec",
- rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
- }
-
- ds = PyList_New(rrd.stat_head->rra_cnt);
- PyDict_SetItemString(r, "rra", ds);
- Py_DECREF(ds);
-
- for (i = 0; i < rrd.stat_head->rra_cnt; i++) {
- PyObject *d, *cdp;
-
- d = PyDict_New();
- PyList_SET_ITEM(ds, i, d);
-
- DICTSET_STR(d, "cf", rrd.rra_def[i].cf_nam);
- DICTSET_CNT(d, "rows", rrd.rra_def[i].row_cnt);
- DICTSET_CNT(d, "pdp_per_row", rrd.rra_def[i].pdp_cnt);
- DICTSET_VAL(d, "xff", rrd.rra_def[i].par[RRA_cdp_xff_val].u_val);
-
- cdp = PyList_New(rrd.stat_head->ds_cnt);
- PyDict_SetItemString(d, "cdp_prep", cdp);
- Py_DECREF(cdp);
-
- for (j = 0; j < rrd.stat_head->ds_cnt; j++) {
- PyObject *cdd;
-
- cdd = PyDict_New();
- PyList_SET_ITEM(cdp, j, cdd);
-
- DICTSET_VAL(cdd, "value",
- rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
- j].scratch[CDP_val].u_val);
- DICTSET_CNT(cdd, "unknown_datapoints",
- rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
- j].scratch[CDP_unkn_pdp_cnt].u_cnt);
- }
- }
-
- rrd_free(&rrd);
-
+ PyObject *r;
+ int argc;
+ char **argv;
+ info_t *data;
+
+ if (create_args("info", args, &argc, &argv) < 0)
+ return NULL;
+
+ if ((data = rrd_info(argc, argv)) == NULL) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ return NULL;
+ }
+ r = PyDict_FromInfo(data);
+ info_free(data);
+ return r;
+}
+
+static char PyRRD_graphv__doc__[] =
+ "graphv is called in the same manner as graph";
+
+static PyObject *PyRRD_graphv(
+ PyObject UNUSED(*self),
+ PyObject * args)
+{
+ PyObject *r;
+ int argc;
+ char **argv;
+ info_t *data;
+
+ if (create_args("graphv", args, &argc, &argv) < 0)
+ return NULL;
+
+ if ((data = rrd_graph_v(argc, argv)) == NULL) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ return NULL;
+ }
+ r = PyDict_FromInfo(data);
+ info_free(data);
+ return r;
+}
+
+static char PyRRD_updatev__doc__[] =
+ "updatev is called in the same manner as update";
+
+static PyObject *PyRRD_updatev(
+ PyObject UNUSED(*self),
+ PyObject * args)
+{
+ PyObject *r;
+ int argc;
+ char **argv;
+ info_t *data;
+
+ if (create_args("updatev", args, &argc, &argv) < 0)
+ return NULL;
+
+ if ((data = rrd_update_v(argc, argv)) == NULL) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ return NULL;
+ }
+ r = PyDict_FromInfo(data);
+ info_free(data);
return r;
}
@@ -521,4 +526,6 @@
meth("resize", PyRRD_resize, PyRRD_resize__doc__),
meth("info", PyRRD_info, PyRRD_info__doc__),
+ meth("graphv", PyRRD_graphv, PyRRD_graphv__doc__),
+ meth("updatev", PyRRD_updatev, PyRRD_updatev__doc__),
{NULL, NULL, 0, NULL}
};
Index: rrdtool/bindings/python/README
===================================================================
--- rrdtool/bindings/python/README (revision 1306)
+++ rrdtool/bindings/python/README (revision 1372)
@@ -1,4 +1,4 @@
-Python-RRDtool 0.2.1
---------------------
+Based on Python-RRDtool 0.2.1
+-----------------------------
The python-rrdtool provides a interface to rrdtool, the wonderful
@@ -20,6 +20,6 @@
-Author
-------
+Original Author
+---------------
Hye-Shik Chang <perky at FreeBSD.org>
@@ -27,2 +27,8 @@
Any comments, suggestions, and/or patches are very welcome.
Thank you for using py-rrdtool!
+
+
+CHANGES
+-------
+2008-05-19 - tobi
+* rewrote the info method to conform to rrdtool info standard
Index: /unk/program/bindings/python/rrd_extra.h
===================================================================
--- rrdtool/bindings/python/rrd_extra.h (revision 1332)
+++ rrdtool/bindings/python/rrd_extra.h (revision )
@@ -1,70 +1,0 @@
-/*
- * This file is part of RRDtool.
- *
- * RRDtool is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * RRDtool 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*****************************************************************************
- * RRDtool 1.0.37 Copyright Tobias Oetiker, 1997 - 2000
- *****************************************************************************
- * rrd_tool.h Common Header File
- *****************************************************************************
- * Id: rrd_tool.h,v 1.1.1.1 2002/02/26 10:21:37 oetiker Exp
- * Log: rrd_tool.h,v
- * Revision 1.1.1.1 2002/02/26 10:21:37 oetiker
- * Intial Import
- *
- *****************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _RRD_EXTRA_H
-#define _RRD_EXTRA_H
-
-#include "rrd_format.h"
-
-#ifndef WIN32
-#ifndef isnan /* POSIX */
- int isnan(
- double value);
-#endif
-#else /* Windows only */
-#include <float.h>
-#define isnan _isnan
-#endif
-
- void rrd_free(
- rrd_t *rrd);
- void rrd_init(
- rrd_t *rrd);
-
- int rrd_open(
- char *file_name,
- rrd_t *rrd,
- int rdwr);
- int readfile(
- char *file,
- char **buffer,
- int skipfirst);
-
-#define RRD_READONLY 0
-#define RRD_READWRITE 1
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
Index: rrdtool/NEWS
===================================================================
--- rrdtool/NEWS (revision 1362)
+++ rrdtool/NEWS (revision 1372)
@@ -1,5 +1,8 @@
RRDTOOL NEWS
============
+
+#####################################
Major Changes between 1.2.x and 1.3.x
+-------------------------------------
RRdtool dump / restore Incompatibilities
@@ -67,7 +70,15 @@
you want to disable this feature
-Misc
-----
+Language Bindings
+-----------------
* ruby rrd_fetch will return step as a last property -- Mike Perham
+
+* python rrdtool.info does now conform with the data structure returned
+ by the other language bindings. This is incompatible with the
+ previous (broken) version --tobi
+
+* python bindings got updatev support --tobi
+
+* ruby, perl, python bindings support the new graphv interface --tobi
Locale Independent Numeric Input
@@ -77,8 +88,7 @@
necessary to make things like RPN work as it uses , as a separator.
-RRDTOOL NEWS
-============
+######################################################################################
Major Changes between 1.0.x and 1.2.x
-
+======================================================================================
Graphing
--------
Index: rrdtool.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rrdtool/F-9/rrdtool.spec,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- rrdtool.spec 19 May 2008 14:43:25 -0000 1.60
+++ rrdtool.spec 20 May 2008 01:54:47 -0000 1.61
@@ -10,7 +10,7 @@
Summary: Round Robin Database Tool to store and display time-series data
Name: rrdtool
Version: 1.3
-Release: 0.16.%{betaver}%{?dist}
+Release: 0.17.%{betaver}%{?dist}
License: GPLv2+ with exceptions
Group: Applications/Databases
URL: http://oss.oetiker.ch/rrdtool/
@@ -20,6 +20,7 @@
Patch1: rrdtool-1.3.0-beta4-fix-rrd_update-in-php-bindings.patch
#Patch2: rrdtool-1.3beta4-fix-python-bindings-rrdtool-info.patch
#Patch3: rrdtool-1.3beta4-fix-cairo.patch
+Patch4: rrdtool-1.3rc4-fix-python-bindings.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: dejavu-lgc-fonts
BuildRequires: gcc-c++, openssl-devel, freetype-devel
@@ -145,6 +146,7 @@
%if %{with_php}
%patch1 -p1
%endif
+%patch4 -p1
# Fix to find correct python dir on lib64
%{__perl} -pi -e 's|get_python_lib\(0,0,prefix|get_python_lib\(1,0,prefix|g' \
@@ -323,6 +325,9 @@
%endif
%changelog
+* Mon May 19 2008 Chris Ricker <kaboom at oobleck.net> 1.3.0-0.17.rc4
+- Patch from upstream for python bindings (bz#435468)
+
* Mon May 19 2008 Chris Ricker <kaboom at oobleck.net> 1.3.0-0.16.rc4
- Rebuild
- Previous message (by thread): rpms/scim-array/devel .cvsignore, 1.5, 1.6 scim-array.spec, 1.8, 1.9 sources, 1.6, 1.7
- Next message (by thread): rpms/rrdtool/F-8 rrdtool-1.3rc4-fix-python-bindings.patch, NONE, 1.1 rrdtool.spec, 1.51, 1.52
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list