| 1 | #! /usr/bin/python |
| 2 | |
| 3 | from distutils.core import setup, Extension |
| 4 | import os as OS |
| 5 | |
| 6 | def needs_update_p(target, deps): |
| 7 | if not OS.path.exists(target): return True |
| 8 | ts = OS.stat(target) |
| 9 | for d in deps: |
| 10 | s = OS.stat(d) |
| 11 | if ts.st_mtime < s.st_mtime: return True |
| 12 | return False |
| 13 | |
| 14 | if needs_update_p('getdate.c', ['getdate.y']): |
| 15 | OS.system('bison -o getdate.c getdate.y') |
| 16 | |
| 17 | setup(name = 'getdate', |
| 18 | version = '1.0.0', |
| 19 | description = 'Date/time parser', |
| 20 | author = 'Mark Wooding', |
| 21 | author_email = 'mdw@distorted.org.uk', |
| 22 | license = 'GNU General Public License', |
| 23 | ext_modules = [Extension('getdate', ['module.c', 'getdate.c'])]) |