X-Git-Url: https://git.distorted.org.uk/~mdw/getdate-python/blobdiff_plain/127ba3759384c65f553ca2664317713da02a1bee..e58b9b2f42717fd3da2a5f2000e81686e72f5ea6:/setup.py diff --git a/setup.py b/setup.py index 51e897b..1a7280b 100644 --- a/setup.py +++ b/setup.py @@ -1,23 +1,22 @@ #! /usr/bin/python -from distutils.core import setup, Extension -import os as OS +import subprocess as SUB -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 +import distutils.core as DC +import mdwsetup as MS -if needs_update_p('getdate.c', ['getdate.y']): - OS.system('bison -o getdate.c getdate.y') +if MS.needs_update_p('getdate.c', ['getdate.y']): + rc = SUB.call(['bison', '-o', 'getdate.c', 'getdate.y']) + if rc: + raise MS.SubprocessFailure, ('bison', rc) -setup(name = 'getdate-python', - 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'])]) +getdate = DC.Extension('getdate', + ['module.c', 'getdate.c']) + +DC.setup(name = 'getdate-python', + version = MS.auto_version(), + description = 'Date/time parser', + author = 'Mark Wooding', + author_email = 'mdw@distorted.org.uk', + license = 'GNU General Public License', + ext_modules = [getdate])