Initial checkin.
[getdate-python] / setup.py
diff --git a/setup.py b/setup.py
new file mode 100644 (file)
index 0000000..41c302d
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,23 @@
+#! /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'])])