[Numpy-svn] r4264 - branches/numpy.scons/numpy/distutils/scons

numpy-svn@scip... numpy-svn@scip...
Sat Oct 20 11:44:56 CDT 2007


Author: cdavid
Date: 2007-10-20 11:44:51 -0500 (Sat, 20 Oct 2007)
New Revision: 4264

Modified:
   branches/numpy.scons/numpy/distutils/scons/__init__.py
   branches/numpy.scons/numpy/distutils/scons/utils.py
Log:
Add isstring func in scons utils

Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-20 16:32:52 UTC (rev 4263)
+++ branches/numpy.scons/numpy/distutils/scons/__init__.py	2007-10-20 16:44:51 UTC (rev 4264)
@@ -3,3 +3,4 @@
 from libinfo import get_paths as scons_get_paths
 #from custom_checkers import CheckTypeSize
 from extension import get_python_inc
+from utils import isstring

Modified: branches/numpy.scons/numpy/distutils/scons/utils.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/utils.py	2007-10-20 16:32:52 UTC (rev 4263)
+++ branches/numpy.scons/numpy/distutils/scons/utils.py	2007-10-20 16:44:51 UTC (rev 4264)
@@ -75,6 +75,27 @@
 
         return self.fun(*(self.pending + args), **kw)
 
+import types
+# Don't "from types import ..." these because we need to get at the
+# types module later to look for UnicodeType.
+DictType        = types.DictType
+InstanceType    = types.InstanceType
+ListType        = types.ListType
+StringType      = types.StringType
+TupleType       = types.TupleType
+if hasattr(types, 'UnicodeType'):
+    UnicodeType = types.UnicodeType
+    def isstring(obj):
+        t = type(obj)
+        return t is StringType \
+            or t is UnicodeType \
+            or (t is InstanceType and isinstance(obj, UserString))
+else:
+    def isstring(obj):
+        t = type(obj)
+        return t is StringType \
+            or (t is InstanceType and isinstance(obj, UserString))
+
 if __name__ == '__main__':
     a1 = 'a.b.c'
     assert a1.split('.', -1) == a1.rsplit('.', -1) == _rsplit(a1, '.', -1)



More information about the Numpy-svn mailing list