--- /dev/null
+getdate.y
+getdate.h
--- /dev/null
+getdate-python (1.0.0) experimental; urgency=low
+
+ * Written!
+
+ -- Mark Wooding <mdw@distorted.org.uk> Wed, 5 Oct 2005 00:34:46 +0100
--- /dev/null
+Source: getdate-python
+Section: libraries
+Priority: extra
+Maintainer: Mark Wooding <mdw@nsict.org>
+Standards-Version: 3.1.1
+
+Package: python-getdate
+Architecture: all
+Depends: python
+Description: Python binding for date parser
+ This is a dummy package for making sure you have the right package for the
+ default Debian Python installation.
+
+Package: python2.3-getdate
+Architecture: any
+Depends: ${shlibs:Depends}, python2.3
+Description: Python binding for date parser
+ This is a dummy package for making sure you have the right package for the
+ default Debian Python installation.
+
+Package: python2.4-getdate
+Architecture: any
+Depends: ${shlibs:Depends}, python2.4
+Description: Python binding for date parser
+ This is a dummy package for making sure you have the right package for the
+ default Debian Python installation.
+
--- /dev/null
+getdate-python is copyright (c) 2003 Straylight/Edgeware
+
+getdate-python is free software; you can redistribute it and/or modify it
+under the terms of the GNU Library General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+getdate-python 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 Library General Public License for
+more details.
+
+You should have a copy of the GNU Library General Public License in
+/usr/share/common-licenses/LGPL-2; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+USA.
--- /dev/null
+#! /usr/bin/make -f
+
+export DH_COMPAT = 4
+
+DEFVERSION = 2.3
+VERSIONS = $(DEFVERSION) 2.4
+
+build: build-stamp
+
+build-stamp:
+ for v in $(VERSIONS); do python$$v setup.py build; done
+ touch build-stamp
+
+clean:
+ dh_clean
+ rm -rf build build-stamp
+
+install: build
+ dh_clean
+ for v in $(VERSIONS); do \
+ python$$v setup.py build; \
+ python$$v setup.py install --root=debian/python$$v-getdate; \
+ done
+ mkdir -p debian/python-getdate
+
+binary-indep: install
+ dh_testdir -i
+ dh_testroot -i
+ dh_compress -i
+ dh_installdocs -i
+ dh_gencontrol -i
+ dh_fixperms -i
+ dh_installdeb -i
+ dh_md5sums -i
+ dh_builddeb -i
+
+binary-arch: install
+ dh_testdir -a
+ dh_testroot -a
+ dh_compress -a
+ dh_installdocs -a
+ dh_strip -a
+ dh_shlibdeps -a
+ dh_gencontrol -a
+ dh_fixperms -a
+ dh_installdeb -a
+ dh_md5sums -a
+ dh_builddeb -a
+
+binary: binary-indep binary-arch
+
+source:
+ rm -rf dist/*.tar.gz dist/=deb=
+ python$(DEFVERSION) setup.py sdist
+ mkdir dist/=deb=
+ cd dist/=deb=; tar xvfz ../*.tar.gz
+ d=`pwd`; cd ..; dpkg-source -i -i'/\.svn/' -b $$d/dist/=deb=/*
+ rm -rf dist/=deb=
+
+.PHONY: binary binary-arch binary-indep clean install source build
--- /dev/null
+#include <Python.h>
+#include "getdate.h"
+
+static PyObject *meth_getdate(PyObject *me, PyObject *arg, PyObject *kw)
+{
+ time_t now, t;
+ int tnow = -1;
+ char *p;
+ static char *kwlist[] = { "string", "now", 0 };
+
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s|i:getdate", kwlist,
+ &p, &tnow))
+ return (0);
+ if (tnow != -1) now = tnow;
+ if ((t = get_date(p, (tnow == -1) ? 0 : &now)) == (time_t)-1) {
+ PyErr_SetString(PyExc_SyntaxError, "Bad time string");
+ return (0);
+ }
+ return (PyInt_FromLong(t));
+}
+
+static PyMethodDef methods[] = {
+ { "getdate", (PyCFunction)meth_getdate, METH_VARARGS | METH_KEYWORDS,
+ "getdate(STRING, now = time.time()) -> TIME" },
+ { 0 }
+};
+
+void initgetdate(void) { Py_InitModule("getdate", methods); }
+
--- /dev/null
+#! /usr/bin/python
+
+from distutils.core import setup, Extension
+import os as OS
+
+def needs_update_p(target, deps):
+ if not OS.path.exists(target): return True
+ ts = OS.stat(target)
+ for d in deps:
+ s = OS.stat(d)
+ if ts.st_mtime < s.st_mtime: return True
+ return False
+
+if needs_update_p('getdate.c', ['getdate.y']):
+ OS.system('bison -o getdate.c getdate.y')
+
+setup(name = 'getdate',
+ version = '1.0.0',
+ description = 'Date/time parser',
+ author = 'Mark Wooding',
+ author_email = 'mdw@distorted.org.uk',
+ license = 'GNU General Public License',
+ ext_modules = [Extension('getdate', ['module.c', 'getdate.c'])])