summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 309e545)
raw | patch | inline | side by side (parent: 309e545)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 10 May 2005 18:52:43 +0000 (18:52 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 10 May 2005 18:52:43 +0000 (18:52 +0000) |
17 files changed:
diff --git a/program/CONTRIBUTORS b/program/CONTRIBUTORS
index bd5147efd2da9ab55de7618afb507ae5bab195f2..14fe14005c034b733002360f9241f0a24b00067f 100644 (file)
--- a/program/CONTRIBUTORS
+++ b/program/CONTRIBUTORS
bring RRDtool into existence.
Alan Lichty <alan_lichty with eli.net>
+Alan Milligan <alan.milligan@last-bastion.net> Python bindings
Alex van den Bogaerdt <alex with ergens.op.het.net> (rrd_resize.c and more)
Amos Shapira <amos with gezernet.co.il>
Andreas Kroomaa <andre with ml.ee>
diff --git a/program/Makefile.am b/program/Makefile.am
index b04965a5db3c27923f3ab29c567b15b2f6311843..0e4263a6d598df49d21b7e6f2f572b963035150e 100644 (file)
--- a/program/Makefile.am
+++ b/program/Makefile.am
site-tcl-install: all
cd bindings/tcl && $(MAKE) tcl-install
+site-python-install: all
+ cd bindings/python && $(MAKE) python-install
+
##END##
diff --git a/program/acinclude.m4 b/program/acinclude.m4
index 7d7cc9ecb98ab4abb7255a15a824519b7d7027f1..6ada55c5efcd91e78f04c77a98245491163be52c 100644 (file)
--- a/program/acinclude.m4
+++ b/program/acinclude.m4
AC_LANG_POP(C)
])
+
+
+dnl a macro to check for ability to create python extensions
+dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
+dnl function also defines PYTHON_INCLUDES
+AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
+[AC_REQUIRE([AM_PATH_PYTHON])
+AC_MSG_CHECKING(for headers required to compile python extensions)
+dnl deduce PYTHON_INCLUDES
+py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+if test "$py_prefix" != "$py_exec_prefix"; then
+ PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+fi
+AC_SUBST(PYTHON_INCLUDES)
+dnl check if the headers exist:
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+AC_TRY_CPP([#include <Python.h>],dnl
+[AC_MSG_RESULT(found)
+$1],dnl
+[AC_MSG_RESULT(not found)
+$2])
+CPPFLAGS="$save_CPPFLAGS"
+])
+
+
index 387a6ec3f96486f79fd990df65961689e624d702..57773b70b534d6e255f582e34701819ecc06eec6 100644 (file)
-SUBDIRS = tcl
+SUBDIRS = tcl python
# the following files are not mentioned in any other Makefile
EXTRA_DIST = perl-piped/MANIFEST perl-piped/README perl-piped/Makefile.PL perl-piped/RRDp.pm perl-piped/t/base.t \
perl-shared/ntmake.pl perl-shared/MANIFEST perl-shared/README perl-shared/Makefile.PL perl-shared/RRDs.pm perl-shared/RRDs.xs perl-shared/t/base.t
diff --git a/program/bindings/python/ACKNOWLEDGEMENT b/program/bindings/python/ACKNOWLEDGEMENT
--- /dev/null
@@ -0,0 +1,7 @@
+ACKNOWLEDGMENT
+==============
+
+This is a list of people who have made contributions to py-rrdtool.
+
+Matthew W. Samsonoff <mws@rochester.rr.com>
+Brian E. Gallew <geek+python@cmu.edu>
diff --git a/program/bindings/python/AUTHORS b/program/bindings/python/AUTHORS
--- /dev/null
@@ -0,0 +1 @@
+Hye-Shik Chang <perky@fallin.lv>
diff --git a/program/bindings/python/COPYING b/program/bindings/python/COPYING
--- /dev/null
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+\f
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library 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 2.1 of the License, or (at your option) any later version.
+
+ This library 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.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/program/bindings/python/Makefile.am b/program/bindings/python/Makefile.am
--- /dev/null
@@ -0,0 +1,15 @@
+AM_CPPFLAGS = @CFLAGS@ -I../../src @PYTHON_INCLUDES@
+
+#pythondir = $(pyexecdir)/python@PYTHON_VERSION@/site-packages
+
+python_PROGRAMS = rrdtoolmodule.so
+
+rrdtoolmodule_so_LDFLAGS = -module -shared -L../../src
+rrdtoolmodule_so_LDADD = -lrrd
+rrdtoolmodule_so_SOURCES = rrdtoolmodule.c
+
+noinst_HEADERS = rrd_extra.h \
+ rrd_format.h
+
+clean:
+ rm -rf build
diff --git a/program/bindings/python/Makefile.in b/program/bindings/python/Makefile.in
--- /dev/null
@@ -0,0 +1,501 @@
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+SOURCES = $(rrdtoolmodule_so_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+python_PROGRAMS = rrdtoolmodule.so$(EXEEXT)
+subdir = bindings/python
+DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in AUTHORS COPYING
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(pythondir)"
+pythonPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(python_PROGRAMS)
+am_rrdtoolmodule_so_OBJECTS = rrdtoolmodule.$(OBJEXT)
+rrdtoolmodule_so_OBJECTS = $(am_rrdtoolmodule_so_OBJECTS)
+rrdtoolmodule_so_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(rrdtoolmodule_so_SOURCES)
+DIST_SOURCES = $(rrdtoolmodule_so_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_MULTITHREAD_FALSE = @BUILD_MULTITHREAD_FALSE@
+BUILD_MULTITHREAD_TRUE = @BUILD_MULTITHREAD_TRUE@
+BUILD_RRDCGI_FALSE = @BUILD_RRDCGI_FALSE@
+BUILD_RRDCGI_TRUE = @BUILD_RRDCGI_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMP_PERL = @COMP_PERL@
+COMP_TCL_FALSE = @COMP_TCL_FALSE@
+COMP_TCL_TRUE = @COMP_TCL_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MULTITHREAD_CFLAGS = @MULTITHREAD_CFLAGS@
+MULTITHREAD_LDFLAGS = @MULTITHREAD_LDFLAGS@
+NROFF = @NROFF@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLCC = @PERLCC@
+PERLFLAGS = @PERLFLAGS@
+PERL_MAKE_OPTIONS = @PERL_MAKE_OPTIONS@
+PERL_VERSION = @PERL_VERSION@
+PKGCONFIG = @PKGCONFIG@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RRDGRAPH_YLEGEND_ANGLE = @RRDGRAPH_YLEGEND_ANGLE@
+RRD_DEFAULT_FONT = @RRD_DEFAULT_FONT@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@
+TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
+TCL_PREFIX = @TCL_PREFIX@
+TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@
+TCL_SHLIB_LD = @TCL_SHLIB_LD@
+TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
+TROFF = @TROFF@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+AM_CPPFLAGS = @CFLAGS@ -I../../src @PYTHON_INCLUDES@
+rrdtoolmodule_so_LDFLAGS = -module -shared -L../../src
+rrdtoolmodule_so_LDADD = -lrrd
+rrdtoolmodule_so_SOURCES = rrdtoolmodule.c
+noinst_HEADERS = rrd_extra.h \
+ rrd_format.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bindings/python/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu bindings/python/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-pythonPROGRAMS: $(python_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(pythondir)" || $(mkdir_p) "$(DESTDIR)$(pythondir)"
+ @list='$(python_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(pythonPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(pythondir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(pythonPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(pythondir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-pythonPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(python_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(pythondir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pythondir)/$$f"; \
+ done
+
+clean-pythonPROGRAMS:
+ @list='$(python_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+rrdtoolmodule.so$(EXEEXT): $(rrdtoolmodule_so_OBJECTS) $(rrdtoolmodule_so_DEPENDENCIES)
+ @rm -f rrdtoolmodule.so$(EXEEXT)
+ $(LINK) $(rrdtoolmodule_so_LDFLAGS) $(rrdtoolmodule_so_OBJECTS) $(rrdtoolmodule_so_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrdtoolmodule.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(pythondir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean-am: clean-generic clean-libtool clean-pythonPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pythonPROGRAMS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pythonPROGRAMS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pythonPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-pythonPROGRAMS install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-pythonPROGRAMS
+
+
+clean:
+ rm -rf build
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/program/bindings/python/README b/program/bindings/python/README
--- /dev/null
@@ -0,0 +1,28 @@
+Python-RRDtool 0.2.1
+--------------------
+
+The python-rrdtool provides a interface to rrdtool, the wonderful
+graphing and logging utility. This wrapper implementation has
+worked from the scratch (without SWIG), and it's under LGPL.
+
+This module have not documented yet. Please refer pydoc.
+
+
+Project
+-------
+
+Homepage: http://www.nongnu.org/py-rrdtool/
+
+Mailing Lists:
+
+ CVS Checkins py-rrdtool-cvs@nongnu.org
+ Users & Hackers py-rrdtool-users@nongnu.org
+
+
+Author
+------
+
+Hye-Shik Chang <perky@FreeBSD.org>
+
+Any comments, suggestions, and/or patches are very welcome.
+Thank you for using py-rrdtool!
diff --git a/program/bindings/python/Setup.in b/program/bindings/python/Setup.in
--- /dev/null
@@ -0,0 +1,2 @@
+*shared*
+_rrdtool _rrdtoolmodule.c -lrrd -I/usr/local/include -L/usr/local/lib
diff --git a/program/bindings/python/rrd_extra.h b/program/bindings/python/rrd_extra.h
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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, FILE **in_file, 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
diff --git a/program/bindings/python/rrd_format.h b/program/bindings/python/rrd_format.h
--- /dev/null
@@ -0,0 +1,324 @@
+/*
+ * 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, 1998, 1999
+ *****************************************************************************
+ * rrd_format.h RRD Database Format header
+ *****************************************************************************/
+
+#ifndef _RRD_FORMAT_H
+#define _RRD_FORMAT_H
+
+#include "rrd.h"
+
+/*****************************************************************************
+ * put this in your /usr/lib/magic file (/etc/magic on HPUX)
+ *
+ * # rrd database format
+ * 0 string RRD\0 rrd file
+ * >5 string >\0 version '%s'
+ *
+ *****************************************************************************/
+
+#define RRD_COOKIE "RRD"
+#define RRD_VERSION "0001"
+#define FLOAT_COOKIE 8.642135E130
+
+#if defined(WIN32)
+#define DNAN ((double)fmod(0.0,0.0))
+#define DINF ((double)log(0.0))
+#else
+
+#define DNAN ((double)(0.0/0.0)) /* we use a DNAN to
+ * represent the UNKNOWN
+ * */
+#define DINF ((double)(1.0/0.0)) /* we use a DINF to
+ * represent a value at the upper or
+ * lower border of the graph ...
+ * */
+#endif
+
+typedef union unival {
+ unsigned long u_cnt;
+ rrd_value_t u_val;
+} unival;
+
+
+/****************************************************************************
+ * The RRD Database Structure
+ * ---------------------------
+ *
+ * In oder to properly describe the database structure lets define a few
+ * new words:
+ *
+ * ds - Data Source (ds) providing input to the database. A Data Source (ds)
+ * can be a traffic counter, a temperature, the number of users logged
+ * into a system. The rrd database format can handle the input of
+ * several Data Sources (ds) in a singe database.
+ *
+ * dst - Data Source Type (dst). The Data Source Type (dst) defines the rules
+ * applied to Build Primary Data Points from the input provided by the
+ * data sources (ds).
+ *
+ * pdp - Primary Data Point (pdp). After the database has accepted the
+ * input from the data sources (ds). It starts building Primary
+ * Data Points (pdp) from the data. Primary Data Points (pdp)
+ * are evenly spaced along the time axis (pdp_step). The values
+ * of the Primary Data Points are calculated from the values of
+ * the data source (ds) and the exact time these values were
+ * provided by the data source (ds).
+ *
+ * pdp_st - PDP Start (pdp_st). The moments (pdp_st) in time where
+ * these steps occur are defined by the moments where the
+ * number of seconds since 1970-jan-1 modulo pdp_step equals
+ * zero (pdp_st).
+ *
+ * cf - Consolidation Function (cf). An arbitrary Consolidation Function (cf)
+ * (averaging, min, max) is applied to the primary data points (pdp) to
+ * calculate the consolidated data point.
+ *
+ * cdp - Consolidated Data Point (cdp) is the long term storage format for data
+ * in the rrd database. Consolidated Data Points represent one or
+ * several primary data points collected along the time axis. The
+ * Consolidated Data Points (cdp) are stored in Round Robin Archives
+ * (rra).
+ *
+ * rra - Round Robin Archive (rra). This is the place where the
+ * consolidated data points (cdp) get stored. The data is
+ * organized in rows (row) and columns (col). The Round Robin
+ * Archive got its name from the method data is stored in
+ * there. An RRD database can contain several Round Robin
+ * Archives. Each Round Robin Archive can have a different row
+ * spacing along the time axis (pdp_cnt) and a different
+ * consolidation function (cf) used to build its consolidated
+ * data points (cdp).
+ *
+ * rra_st - RRA Start (rra_st). The moments (rra_st) in time where
+ * Consolidated Data Points (cdp) are added to an rra are
+ * defined by the moments where the number of seconds since
+ * 1970-jan-1 modulo pdp_cnt*pdp_step equals zero (rra_st).
+ *
+ * row - Row (row). A row represent all consolidated data points (cdp)
+ * in a round robin archive who are of the same age.
+ *
+ * col - Column (col). A column (col) represent all consolidated
+ * data points (cdp) in a round robin archive (rra) who
+ * originated from the same data source (ds).
+ *
+ */
+
+/****************************************************************************
+ * POS 1: stat_head_t static header of the database
+ ****************************************************************************/
+
+typedef struct stat_head_t {
+
+ /* Data Base Identification Section ***/
+ char cookie[4]; /* RRD */
+ char version[5]; /* version of the format */
+ double float_cookie; /* is it the correct double
+ * representation ? */
+
+ /* Data Base Structure Definition *****/
+ unsigned long ds_cnt; /* how many different ds provide
+ * input to the rrd */
+ unsigned long rra_cnt; /* how many rras will be maintained
+ * in the rrd */
+ unsigned long pdp_step; /* pdp interval in seconds */
+
+ unival par[10]; /* global parameters ... unused
+ at the moment */
+} stat_head_t;
+
+
+/****************************************************************************
+ * POS 2: ds_def_t (* ds_cnt) Data Source definitions
+ ****************************************************************************/
+
+enum dst_en { DST_COUNTER=0, /* data source types available */
+ DST_ABSOLUTE,
+ DST_GAUGE,
+ DST_DERIVE};
+
+enum ds_param_en { DS_mrhb_cnt=0, /* minimum required heartbeat. A
+ * data source must provide input at
+ * least every ds_mrhb seconds,
+ * otherwise it is regarded dead and
+ * will be set to UNKNOWN */
+ DS_min_val, /* the processed input of a ds must */
+ DS_max_val }; /* be between max_val and min_val
+ * both can be set to UNKNOWN if you
+ * do not care. Data outside the limits
+ * set to UNKNOWN */
+
+/* The magic number here is one less than DS_NAM_SIZE */
+#define DS_NAM_FMT "%19[a-zA-Z0-9_-]"
+#define DS_NAM_SIZE 20
+
+#define DST_FMT "%19[A-Z]"
+#define DST_SIZE 20
+
+typedef struct ds_def_t {
+ char ds_nam[DS_NAM_SIZE]; /* Name of the data source (null terminated)*/
+ char dst[DST_SIZE]; /* Type of data source (null terminated)*/
+ unival par[10]; /* index of this array see ds_param_en */
+} ds_def_t;
+
+/****************************************************************************
+ * POS 3: rra_def_t ( * rra_cnt) one for each store to be maintained
+ ****************************************************************************/
+enum cf_en { CF_AVERAGE=0, /* data consolidation functions */
+ CF_MINIMUM,
+ CF_MAXIMUM,
+ CF_LAST};
+
+enum rra_par_en { RRA_cdp_xff_val=0}; /* what part of the consolidated
+ datapoint may be unknown, while
+ still a valid entry in goes into the rra */
+
+#define CF_NAM_FMT "%19[A-Z]"
+#define CF_NAM_SIZE 20
+
+typedef struct rra_def_t {
+ char cf_nam[CF_NAM_SIZE];/* consolidation function (null term) */
+ unsigned long row_cnt; /* number of entries in the store */
+ unsigned long pdp_cnt; /* how many primary data points are
+ * required for a consolidated data
+ * point?*/
+ unival par[10]; /* index see rra_param_en */
+
+} rra_def_t;
+
+
+/****************************************************************************
+ ****************************************************************************
+ ****************************************************************************
+ * LIVE PART OF THE HEADER. THIS WILL BE WRITTEN ON EVERY UPDATE *
+ ****************************************************************************
+ ****************************************************************************
+ ****************************************************************************/
+/****************************************************************************
+ * POS 4: live_head_t
+ ****************************************************************************/
+
+typedef struct live_head_t {
+ time_t last_up; /* when was rrd last updated */
+} live_head_t;
+
+
+/****************************************************************************
+ * POS 5: pdp_prep_t (* ds_cnt) here we prepare the pdps
+ ****************************************************************************/
+#define LAST_DS_LEN 30 /* DO NOT CHANGE THIS ... */
+
+enum pdp_par_en { PDP_unkn_sec_cnt=0, /* how many seconds of the current
+ * pdp value is unknown data? */
+
+ PDP_val}; /* current value of the pdp.
+ this depends on dst */
+
+typedef struct pdp_prep_t{
+ char last_ds[LAST_DS_LEN]; /* the last reading from the data
+ * source. this is stored in ASCII
+ * to cater for very large counters
+ * we might encounter in connection
+ * with SNMP. */
+ unival scratch[10]; /* contents according to pdp_par_en */
+} pdp_prep_t;
+
+/* data is passed from pdp to cdp when seconds since epoch modulo pdp_step == 0
+ obviously the updates do not occur at these times only. Especially does the
+ format allow for updates to occur at different times for each data source.
+ The rules which makes this work is as follows:
+
+ * DS updates may only occur at ever increasing points in time
+ * When any DS update arrives after a cdp update time, the *previous*
+ update cycle gets executed. All pdps are transfered to cdps and the
+ cdps feed the rras where necessary. Only then the new DS value
+ is loaded into the PDP. */
+
+
+/****************************************************************************
+ * POS 6: cdp_prep_t (* rra_cnt * ds_cnt ) data prep area for cdp values
+ ****************************************************************************/
+enum cdp_par_en { CDP_val=0, /* the base_interval is always an
+ * average */
+ CDP_unkn_pdp_cnt }; /* how many unknown pdp were
+ * integrated. This and the cdp_xff
+ will decide if this is going to
+ be a UNKNOWN or a valid value */
+
+typedef struct cdp_prep_t{
+ unival scratch[10]; /* contents according to cdp_par_en *
+ * init state should be NAN */
+
+} cdp_prep_t;
+
+/****************************************************************************
+ * POS 7: rra_ptr_t (* rra_cnt) pointers to the current row in each rra
+ ****************************************************************************/
+
+typedef struct rra_ptr_t {
+ unsigned long cur_row; /* current row in the rra*/
+} rra_ptr_t;
+
+
+/****************************************************************************
+ ****************************************************************************
+ * One single struct to hold all the others. For convenience.
+ ****************************************************************************
+ ****************************************************************************/
+typedef struct rrd_t {
+ stat_head_t *stat_head; /* the static header */
+ ds_def_t *ds_def; /* list of data source definitions */
+ rra_def_t *rra_def; /* list of round robin archive def */
+ live_head_t *live_head;
+ pdp_prep_t *pdp_prep; /* pdp data prep area */
+ cdp_prep_t *cdp_prep; /* cdp prep area */
+ rra_ptr_t *rra_ptr; /* list of rra pointers */
+ rrd_value_t *rrd_value; /* list of rrd values */
+} rrd_t;
+
+/****************************************************************************
+ ****************************************************************************
+ * AFTER the header section we have the DATA STORAGE AREA it is made up from
+ * Consolidated Data Points organized in Round Robin Archives.
+ ****************************************************************************
+ ****************************************************************************
+
+ *RRA 0
+ (0,0) .................... ( ds_cnt -1 , 0)
+ .
+ .
+ .
+ (0, row_cnt -1) ... (ds_cnt -1, row_cnt -1)
+
+ *RRA 1
+ *RRA 2
+
+ *RRA rra_cnt -1
+
+ ****************************************************************************/
+
+
+#endif
+
+
+
+
diff --git a/program/bindings/python/rrdtoolmodule.c b/program/bindings/python/rrdtoolmodule.c
--- /dev/null
@@ -0,0 +1,504 @@
+/*
+ * rrdtoolmodule.c
+ *
+ * RRDTool Python binding
+ *
+ * Author : Hye-Shik Chang <perky@fallin.lv>
+ * Date : $Date: 2003/02/22 07:41:19 $
+ * Created : 23 May 2002
+ *
+ * $Revision: 1.14 $
+ *
+ * ==========================================================================
+ * This file is part of py-rrdtool.
+ *
+ * py-rrdtool 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * py-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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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
+ *
+ */
+
+static const char *__version__ = "$Revision: 1.14 $";
+
+#include "Python.h"
+#include "rrd.h"
+#include "rrd_extra.h"
+
+static PyObject *ErrorObject;
+extern int optind, opterr;
+
+static int
+create_args(char *command, PyObject *args, int *argc, char ***argv)
+{
+ PyObject *o;
+ int size, i;
+
+ size = PyTuple_Size(args);
+ *argv = PyMem_New(char *, size + 1);
+ if (*argv == NULL)
+ return -1;
+
+ for (i = 0; i < size; i++) {
+ o = PyTuple_GET_ITEM(args, i);
+ if (PyString_Check(o))
+ (*argv)[i + 1] = PyString_AS_STRING(o);
+ else {
+ PyMem_Del(*argv);
+ PyErr_Format(PyExc_TypeError, "argument %d must be string", i);
+ return -1;
+ }
+ }
+ (*argv)[0] = command;
+ *argc = size + 1;
+
+ /* reset getopt state */
+ opterr = optind = 0;
+
+ return 0;
+}
+
+static void
+destroy_args(char ***argv)
+{
+ PyMem_Del(*argv);
+ *argv = NULL;
+}
+
+static char PyRRD_create__doc__[] =
+"create(args..): Set up a new Round Robin Database\n\
+ create filename [--start|-b start time] \
+[--step|-s step] [DS:ds-name:DST:heartbeat:min:max] \
+[RRA:CF:xff:steps:rows]";
+
+static PyObject *
+PyRRD_create(PyObject *self, PyObject *args)
+{
+ PyObject *r;
+ char **argv;
+ int argc;
+
+ if (create_args("create", args, &argc, &argv) < 0)
+ return NULL;
+
+ if (rrd_create(argc, argv) == -1) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ r = NULL;
+ } else {
+ Py_INCREF(Py_None);
+ r = Py_None;
+ }
+
+ destroy_args(&argv);
+ return r;
+}
+
+static char PyRRD_update__doc__[] =
+"update(args..): Store a new set of values into the rrd\n"
+" update filename [--template|-t ds-name[:ds-name]...] "
+"N|timestamp:value[:value...] [timestamp:value[:value...] ...]";
+
+static PyObject *
+PyRRD_update(PyObject *self, PyObject *args)
+{
+ PyObject *r;
+ char **argv;
+ int argc;
+
+ if (create_args("update", args, &argc, &argv) < 0)
+ return NULL;
+
+ if (rrd_update(argc, argv) == -1) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ r = NULL;
+ } else {
+ Py_INCREF(Py_None);
+ r = Py_None;
+ }
+
+ destroy_args(&argv);
+ return r;
+}
+
+static char PyRRD_fetch__doc__[] =
+"fetch(args..): fetch data from an rrd.\n"
+" fetch filename CF [--resolution|-r resolution] "
+"[--start|-s start] [--end|-e end]";
+
+static PyObject *
+PyRRD_fetch(PyObject *self, PyObject *args)
+{
+ PyObject *r;
+ rrd_value_t *data, *datai;
+ unsigned long step, ds_cnt;
+ time_t start, end;
+ int argc;
+ char **argv, **ds_namv;
+
+ if (create_args("fetch", args, &argc, &argv) < 0)
+ return NULL;
+
+ if (rrd_fetch(argc, argv, &start, &end, &step,
+ &ds_cnt, &ds_namv, &data) == -1) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ r = NULL;
+ } else {
+ /* Return :
+ ((start, end, step), (name1, name2, ...), [(data1, data2, ..), ...]) */
+ PyObject *range_tup, *dsnam_tup, *data_list, *t;
+ int i, j, row;
+ rrd_value_t dv;
+
+ row = ((end - start) / step + 1);
+
+ r = PyTuple_New(3);
+ range_tup = PyTuple_New(3);
+ dsnam_tup = PyTuple_New(ds_cnt);
+ data_list = PyList_New(row);
+ PyTuple_SET_ITEM(r, 0, range_tup);
+ PyTuple_SET_ITEM(r, 1, dsnam_tup);
+ PyTuple_SET_ITEM(r, 2, data_list);
+
+ datai = data;
+
+ PyTuple_SET_ITEM(range_tup, 0, PyInt_FromLong((long)start));
+ PyTuple_SET_ITEM(range_tup, 1, PyInt_FromLong((long)end));
+ PyTuple_SET_ITEM(range_tup, 2, PyInt_FromLong((long)step));
+
+ for (i = 0; i < ds_cnt; i++)
+ PyTuple_SET_ITEM(dsnam_tup, i, PyString_FromString(ds_namv[i]));
+
+ for (i = 0; i < row; i ++) {
+ t = PyTuple_New(ds_cnt);
+ PyList_SET_ITEM(data_list, i, t);
+
+ for (j = 0; j < ds_cnt; j++) {
+ dv = *(datai++);
+ if (isnan(dv)) {
+ PyTuple_SET_ITEM(t, j, Py_None);
+ Py_INCREF(Py_None);
+ } else {
+ PyTuple_SET_ITEM(t, j, PyFloat_FromDouble((double)dv));
+ }
+ }
+ }
+
+ for (i = 0; i < ds_cnt; i++)
+ free(ds_namv[i]);
+ free(ds_namv); /* rrdtool don't use PyMem_Malloc :) */
+ free(data);
+ }
+
+ destroy_args(&argv);
+ return r;
+}
+
+static char PyRRD_graph__doc__[] =
+"graph(args..): Create a graph based on data from one or several RRD\n"
+" graph filename [-s|--start seconds] "
+"[-e|--end seconds] [-x|--x-grid x-axis grid and label] "
+"[-y|--y-grid y-axis grid and label] [--alt-y-grid] [--alt-y-mrtg] "
+"[--alt-autoscale] [--alt-autoscale-max] [--units-exponent] value "
+"[-v|--vertical-label text] [-w|--width pixels] [-h|--height pixels] "
+"[-i|--interlaced] "
+"[-f|--imginfo formatstring] [-a|--imgformat GIF|PNG|GD] "
+"[-B|--background value] [-O|--overlay value] "
+"[-U|--unit value] [-z|--lazy] [-o|--logarithmic] "
+"[-u|--upper-limit value] [-l|--lower-limit value] "
+"[-g|--no-legend] [-r|--rigid] [--step value] "
+"[-b|--base value] [-c|--color COLORTAG#rrggbb] "
+"[-t|--title title] [DEF:vname=rrd:ds-name:CF] "
+"[CDEF:vname=rpn-expression] [PRINT:vname:CF:format] "
+"[GPRINT:vname:CF:format] [COMMENT:text] "
+"[HRULE:value#rrggbb[:legend]] [VRULE:time#rrggbb[:legend]] "
+"[LINE{1|2|3}:vname[#rrggbb[:legend]]] "
+"[AREA:vname[#rrggbb[:legend]]] "
+"[STACK:vname[#rrggbb[:legend]]]";
+
+static PyObject *
+PyRRD_graph(PyObject *self, PyObject *args)
+{
+ PyObject *r;
+ char **argv, **calcpr;
+ int argc, xsize, ysize, i;
+ double ymin, ymax;
+ if (create_args("graph", args, &argc, &argv) < 0)
+ return NULL;
+
+ if (rrd_graph(argc, argv, &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) == -1) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ r = NULL;
+ } else {
+ r = PyTuple_New(3);
+
+ PyTuple_SET_ITEM(r, 0, PyInt_FromLong((long)xsize));
+ PyTuple_SET_ITEM(r, 1, PyInt_FromLong((long)ysize));
+
+ if (calcpr) {
+ PyObject *e, *t;
+
+ e = PyList_New(0);
+ PyTuple_SET_ITEM(r, 2, e);
+
+ for(i = 0; calcpr[i]; i++) {
+ t = PyString_FromString(calcpr[i]);
+ PyList_Append(e, t);
+ Py_DECREF(t);
+ free(calcpr[i]);
+ }
+ free(calcpr);
+ } else {
+ Py_INCREF(Py_None);
+ PyTuple_SET_ITEM(r, 2, Py_None);
+ }
+ }
+
+ destroy_args(&argv);
+ return r;
+}
+
+static char PyRRD_tune__doc__[] =
+"tune(args...): Modify some basic properties of a Round Robin Database\n"
+" tune filename [--heartbeat|-h ds-name:heartbeat] "
+"[--minimum|-i ds-name:min] [--maximum|-a ds-name:max] "
+"[--data-source-type|-d ds-name:DST] [--data-source-rename|-r old-name:new-name]";
+
+static PyObject *
+PyRRD_tune(PyObject *self, PyObject *args)
+{
+ PyObject *r;
+ char **argv;
+ int argc;
+
+ if (create_args("tune", args, &argc, &argv) < 0)
+ return NULL;
+
+ if (rrd_tune(argc, argv) == -1) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ r = NULL;
+ } else {
+ Py_INCREF(Py_None);
+ r = Py_None;
+ }
+
+ destroy_args(&argv);
+ return r;
+}
+
+static char PyRRD_last__doc__[] =
+"last(filename): Return the timestamp of the last data sample in an RRD";
+
+static PyObject *
+PyRRD_last(PyObject *self, PyObject *args)
+{
+ PyObject *r;
+ int argc, ts;
+ char **argv;
+
+ if (create_args("last", args, &argc, &argv) < 0)
+ return NULL;
+
+ if ((ts = rrd_last(argc, argv)) == -1) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ r = NULL;
+ } else
+ r = PyInt_FromLong((long)ts);
+
+ destroy_args(&argv);
+ return r;
+}
+
+static char PyRRD_resize__doc__[] =
+"resize(args...): alters the size of an RRA.\n"
+" resize filename rra-num GROW|SHRINK rows";
+
+static PyObject *
+PyRRD_resize(PyObject *self, PyObject *args)
+{
+ PyObject *r;
+ char **argv;
+ int argc, ts;
+
+ if (create_args("resize", args, &argc, &argv) < 0)
+ return NULL;
+
+ if ((ts = rrd_resize(argc, argv)) == -1) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ r = NULL;
+ } else {
+ Py_INCREF(Py_None);
+ r = Py_None;
+ }
+
+ destroy_args(&argv);
+ return r;
+}
+
+static char PyRRD_info__doc__[] =
+"info(filename): extract header information from an rrd";
+
+static PyObject *
+PyRRD_info(PyObject *self, PyObject *args)
+{
+ PyObject *r, *t, *ds;
+ rrd_t rrd;
+ FILE *in_file;
+ char *filename;
+ int i, j;
+
+ if (! PyArg_ParseTuple(args, "s:info", &filename))
+ return NULL;
+
+ if (rrd_open(filename, &in_file, &rrd, RRD_READONLY) == -1) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ return NULL;
+ }
+ fclose(in_file);
+
+#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);
+
+ return r;
+}
+
+/* List of methods defined in the module */
+#define meth(name, func, doc) {name, (PyCFunction)func, METH_VARARGS, doc}
+
+static struct PyMethodDef _rrdtool_methods[] = {
+ meth("create", PyRRD_create, PyRRD_create__doc__),
+ meth("update", PyRRD_update, PyRRD_update__doc__),
+ meth("fetch", PyRRD_fetch, PyRRD_fetch__doc__),
+ meth("graph", PyRRD_graph, PyRRD_graph__doc__),
+ meth("tune", PyRRD_tune, PyRRD_tune__doc__),
+ meth("last", PyRRD_last, PyRRD_last__doc__),
+ meth("resize", PyRRD_resize, PyRRD_resize__doc__),
+ meth("info", PyRRD_info, PyRRD_info__doc__),
+ {NULL, NULL},
+};
+
+#define SET_INTCONSTANT(dict, value) \
+ t = PyInt_FromLong((long)value); \
+ PyDict_SetItemString(dict, #value, t); \
+ Py_DECREF(t);
+#define SET_STRCONSTANT(dict, value) \
+ t = PyString_FromString(value); \
+ PyDict_SetItemString(dict, #value, t); \
+ Py_DECREF(t);
+
+/* Initialization function for the module */
+void
+initrrdtool(void)
+{
+ PyObject *m, *d, *t;
+
+ /* Create the module and add the functions */
+ m = Py_InitModule("rrdtool", _rrdtool_methods);
+
+ /* Add some symbolic constants to the module */
+ d = PyModule_GetDict(m);
+
+ SET_STRCONSTANT(d, __version__);
+ ErrorObject = PyErr_NewException("_rrdtool.error", NULL, NULL);
+ PyDict_SetItemString(d, "error", ErrorObject);
+
+ /* Check for errors */
+ if (PyErr_Occurred())
+ Py_FatalError("can't initialize the rrdtool module");
+}
+
+/*
+ * $Id: _rrdtoolmodule.c,v 1.14 2003/02/22 07:41:19 perky Exp $
+ * ex: ts=8 sts=4 et
+ */
diff --git a/program/bindings/python/setup.py b/program/bindings/python/setup.py
--- /dev/null
@@ -0,0 +1,55 @@
+#! /usr/bin/env python
+#
+# setup.py
+#
+# py-rrdtool distutil setup
+#
+# Author : Hye-Shik Chang <perky@fallin.lv>
+# Date : $Date: 2003/02/14 02:38:16 $
+# Created : 24 May 2002
+#
+# $Revision: 1.7 $
+#
+# ==========================================================================
+# This file is part of py-rrdtool.
+#
+# py-rrdtool 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 2 of the License, or
+# (at your option) any later version.
+#
+# py-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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser 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
+#
+
+from distutils.core import setup, Extension
+import sys, os
+
+RRDBASE = os.environ.get('LOCALBASE', '../../src')
+library_dir = os.environ.get('LIBDIR', os.path.join(RRDBASE, 'lib'))
+include_dir = os.environ.get('INCDIR', RRDBASE)
+
+setup(name = "py-rrdtool",
+ version = "0.2.1",
+ description = "Python Interface to RRDTool",
+ author = "Hye-Shik Chang",
+ author_email = "perky@fallin.lv",
+ license = "LGPL",
+ url = "http://people.ee.ethz.ch/~oetiker/webtools/rrdtool",
+ #packages = ['rrdtool'],
+ ext_modules = [
+ Extension(
+ "rrdtoolmodule",
+ ["rrdtoolmodule.c"],
+ libraries=['rrd'],
+ library_dirs=[library_dir],
+ include_dirs=[include_dir],
+ )
+ ]
+)
diff --git a/program/configure.ac b/program/configure.ac
index 9c4b3812cc3f8ede9570d4514d463bf8beaa3c54..912e68b719da9ee82c6c324d20bac30eaf16e0f6 100644 (file)
--- a/program/configure.ac
+++ b/program/configure.ac
AC_SUBST(TCL_PACKAGE_PATH)
AC_SUBST(TCL_LD_SEARCH_FLAGS)
+dnl Check for python
+AM_PATH_PYTHON(2.3)
+AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
+
dnl Check for nroff
src/Makefile \
bindings/Makefile \
bindings/tcl/Makefile \
+ bindings/python/Makefile \
Makefile])
AC_CONFIG_COMMANDS([default],[[\
chmod +x examples/*.cgi examples/*.pl]],[[]])
echo " Perl Version: $PERL_VERSION"
echo " Perl Options: $PERL_MAKE_OPTIONS"
echo " Tcl Config: $tcl_config"
+echo " Python Version: $PYTHON_VERSION"
echo " Build rrdcgi: $enable_rrdcgi"
echo " Build librrd MT: $enable_pthread"
echo
diff --git a/program/rrdtool.spec b/program/rrdtool.spec
index 82a2b822d3c567d8b8b5182307481bebab1530c0..ba69e62b4288216dcb1bdb805503a1c45ddd0b52 100644 (file)
--- a/program/rrdtool.spec
+++ b/program/rrdtool.spec
%description perl
The RRD Tools Perl modules.
+%package python
+Summary: RRD Tool Python interface
+Group: Applications/Databases
+Requires: %{name} = %{version} python >= 2.3
+
+%description python
+The RRD Tools Python modules.
+
+%prep
+%setup -q -n rrdtool-%{cvsdate}
%prep
%setup -q -n rrdtool-%{cvsdate}
%{_mandir}/man1/RRDp.1*
%{_mandir}/man1/RRDs.1*
+%files python
+%{_libdir}/python*/site-packages/*
+
%changelog
+* Wed May 11 2005 Alan Milligan <alan.milligan@last-bastion.net>
+- python support
* Wed May 26 2004 Mike Slifcak <slif@bellsouth.net> 1.1.0-0.1.20040526
- package examples with rrdtool-perl (decouple Perl from main package)
* Thu Apr 29 2004 Chris Adams <cmadams@hiwaay.net> 1.1.0-0.1.20040430