[Python-checkins] CVS: distutils/examples mxdatetime_setup.py,1.4,1.5
Greg Ward
python-dev@python.org
Sat, 24 Jun 2000 19:44:14 -0700
Update of /cvsroot/python/distutils/examples
In directory slayer.i.sourceforge.net:/tmp/cvs-serv16430
Modified Files:
mxdatetime_setup.py
Log Message:
Added the config_mxDateTime class to do auto-configuration. Currently works,
but has no effect: determines which functions are available, but there's
no way to communicate that to the extension-building machinery.
Index: mxdatetime_setup.py
===================================================================
RCS file: /cvsroot/python/distutils/examples/mxdatetime_setup.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** mxdatetime_setup.py 2000/03/02 01:49:46 1.4
--- mxdatetime_setup.py 2000/06/25 02:44:11 1.5
***************
*** 8,13 ****
--- 8,44 ----
__revision__ = "$Id$"
+ import string
from distutils.core import setup
+ from distutils.command.config import config
+ class config_mxDateTime (config):
+
+ def run (self):
+ have = {}
+ have['strftime'] = self.check_func('strftime', ['time.h'])
+ have['strptime'] = self.check_func('strptime', ['time.h'])
+ have['timegm'] = self.check_func('timegm', ['time.h'])
+
+ define = []
+ undef = []
+ for name in have.keys(): # ('strftime', 'strptime', 'timegm'):
+ macro_name = 'HAVE_' + string.upper(name)
+ if have[name]:
+ define.append((macro_name, None))
+ else:
+ undef.append(macro_name)
+
+ print "macros to define:", define
+ print "macros to undefine:", undef
+
+ build = self.distribution.reinitialize_command('build')
+ build.define = define
+ build.undef = undef
+
+ # run ()
+
+ # class config_mxDateTime
+
+
setup (name = "mxDateTime",
version = "1.3.0",
***************
*** 17,20 ****
--- 48,52 ----
url = "http://starship.python.net/~lemburg/mxDateTime.html",
+ cmdclass = {'config': config_mxDateTime},
packages = ['DateTime', 'DateTime.Examples', 'DateTime.mxDateTime'],
package_dir = {'DateTime': ''},
***************
*** 25,31 ****
{ 'sources': ['mxDateTime/mxDateTime.c'],
'include_dirs': ['mxDateTime'],
! 'macros': [('HAVE_STRFTIME', None),
! ('HAVE_STRPTIME', None),
! ('HAVE_TIMEGM', None)], }
)]
)
--- 57,61 ----
{ 'sources': ['mxDateTime/mxDateTime.c'],
'include_dirs': ['mxDateTime'],
! }
)]
)