from Symtab import BuiltinScope, StructOrUnionScope
from TypeSlots import Signature
import PyrexTypes
+import __builtin__
builtin_function_table = [
# name, args, return, C API func, py equiv = "*"
("keys", "O", "O", "PyDict_Keys"),
("values","O", "O", "PyDict_Values")]),
- ("set", "PySet_Type", [("clear", "O", "i", "PySet_Clear"),
- ("discard", "OO", "i", "PySet_Discard"),
- ("add", "OO", "i", "PySet_Add"),
- ("pop", "O", "O", "PySet_Pop")]),
-
- ("frozenset", "PyFrozenSet_Type", []),
-
("slice", "PySlice_Type", []),
("file", "PyFile_Type", []),
]
+
+if 'set' in __builtin__.__dict__:
+ builtin_types_table += [
+ ("set", "PySet_Type", [("clear", "O", "i", "PySet_Clear"),
+ ("discard", "OO", "i", "PySet_Discard"),
+ ("add", "OO", "i", "PySet_Add"),
+ ("pop", "O", "O", "PySet_Pop")]),
+
+ ("frozenset", "PyFrozenSet_Type", []),
+ ]
+
+
builtin_structs_table = [
('Py_buffer', 'Py_buffer',
'numpy' : re.compile('.*\.numpy_.*').match
}
+VER_DEP_MODULES = {
+ (2,4) : lambda x: x in ['run.set']
+}
+
INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE', '').split(os.pathsep) if d ]
CFLAGS = os.getenv('CFLAGS', '').split()
return True
return False
+class VersionDependencyExcluder:
+ def __init__(self, deps):
+ # deps: { version : matcher func }
+ from sys import version_info
+ self.exclude_matchers = []
+ for ver, matcher in deps.items():
+ if version_info < ver:
+ self.exclude_matchers.append(matcher)
+ self.tests_missing_deps = []
+ def __call__(self, testname):
+ for matcher in self.exclude_matchers:
+ if matcher(testname):
+ self.tests_missing_deps.append(testname)
+ return True
+ return False
+
if __name__ == '__main__':
from optparse import OptionParser
parser = OptionParser()
# which depends on them (by prefix)
missing_dep_excluder = MissingDependencyExcluder(EXT_DEP_MODULES)
- exclude_selectors = [missing_dep_excluder] # want to pring msg at exit
+ version_dep_excluder = VersionDependencyExcluder(VER_DEP_MODULES)
+ exclude_selectors = [missing_dep_excluder, version_dep_excluder] # want to pring msg at exit
if options.exclude:
exclude_selectors += [ re.compile(r, re.I|re.U).search for r in options.exclude ]