SConscript (12362:b485016c498f) SConscript (12363:8ca0fee7f9b3)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 57 unchanged lines hidden (view full) ---

66 def with_tags_that(self, predicate):
67 '''Return a list of sources with tags that satisfy a predicate.'''
68 def match(source):
69 return predicate(source.tags)
70 return SourceList(filter(match, self))
71
72 def with_any_tags(self, *tags):
73 '''Return a list of sources with any of the supplied tags.'''
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 57 unchanged lines hidden (view full) ---

66 def with_tags_that(self, predicate):
67 '''Return a list of sources with tags that satisfy a predicate.'''
68 def match(source):
69 return predicate(source.tags)
70 return SourceList(filter(match, self))
71
72 def with_any_tags(self, *tags):
73 '''Return a list of sources with any of the supplied tags.'''
74 return self.with_tags_that(lambda stags: len(tags & stags) > 0)
74 return self.with_tags_that(lambda stags: len(set(tags) & stags) > 0)
75
76 def with_all_tags(self, *tags):
77 '''Return a list of sources with all of the supplied tags.'''
75
76 def with_all_tags(self, *tags):
77 '''Return a list of sources with all of the supplied tags.'''
78 return self.with_tags_that(lambda stags: tags <= stags)
78 return self.with_tags_that(lambda stags: set(tags) <= stags)
79
80 def with_tag(self, tag):
81 '''Return a list of sources with the supplied tag.'''
82 return self.with_tags_that(lambda stags: tag in stags)
83
84 def without_tags(self, *tags):
85 '''Return a list of sources without any of the supplied tags.'''
79
80 def with_tag(self, tag):
81 '''Return a list of sources with the supplied tag.'''
82 return self.with_tags_that(lambda stags: tag in stags)
83
84 def without_tags(self, *tags):
85 '''Return a list of sources without any of the supplied tags.'''
86 return self.with_tags_that(lambda stags: len(tags & stags) == 0)
86 return self.with_tags_that(lambda stags: len(set(tags) & stags) == 0)
87
88 def without_tag(self, tag):
89 '''Return a list of sources with the supplied tag.'''
90 return self.with_tags_that(lambda stags: tag not in stags)
91
92class SourceMeta(type):
93 '''Meta class for source files that keeps track of all files of a
94 particular type.'''

--- 11 unchanged lines hidden (view full) ---

106 static_objs = {}
107 shared_objs = {}
108
109 def __init__(self, source, tags=None, add_tags=None):
110 if tags is None:
111 tags='gem5 lib'
112 if isinstance(tags, basestring):
113 tags = set([tags])
87
88 def without_tag(self, tag):
89 '''Return a list of sources with the supplied tag.'''
90 return self.with_tags_that(lambda stags: tag not in stags)
91
92class SourceMeta(type):
93 '''Meta class for source files that keeps track of all files of a
94 particular type.'''

--- 11 unchanged lines hidden (view full) ---

106 static_objs = {}
107 shared_objs = {}
108
109 def __init__(self, source, tags=None, add_tags=None):
110 if tags is None:
111 tags='gem5 lib'
112 if isinstance(tags, basestring):
113 tags = set([tags])
114 if isinstance(add_tags, basestring):
115 add_tags = set([add_tags])
114 if not isinstance(tags, set):
115 tags = set(tags)
116 self.tags = tags
117
116 if add_tags:
118 if add_tags:
117 tags = tags | add_tags
118 self.tags = set(tags)
119 if isinstance(add_tags, basestring):
120 add_tags = set([add_tags])
121 if not isinstance(add_tags, set):
122 add_tags = set(add_tags)
123 self.tags |= add_tags
119
120 tnode = source
121 if not isinstance(source, SCons.Node.FS.File):
122 tnode = File(source)
123
124 self.tnode = tnode
125 self.snode = tnode.srcnode()
126

--- 1052 unchanged lines hidden ---
124
125 tnode = source
126 if not isinstance(source, SCons.Node.FS.File):
127 tnode = File(source)
128
129 self.tnode = tnode
130 self.snode = tnode.srcnode()
131

--- 1052 unchanged lines hidden ---