本文整理汇总了Python中mozbuild.backend.recursivemake.RecursiveMakeTraversal.add方法的典型用法代码示例。如果您正苦于以下问题:Python RecursiveMakeTraversal.add方法的具体用法?Python RecursiveMakeTraversal.add怎么用?Python RecursiveMakeTraversal.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozbuild.backend.recursivemake.RecursiveMakeTraversal
的用法示例。
在下文中一共展示了RecursiveMakeTraversal.add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_traversal
# 需要导入模块: from mozbuild.backend.recursivemake import RecursiveMakeTraversal [as 别名]
# 或者: from mozbuild.backend.recursivemake.RecursiveMakeTraversal import add [as 别名]
def test_traversal(self):
traversal = RecursiveMakeTraversal()
traversal.add('', dirs=['A', 'B', 'C'])
traversal.add('', dirs=['D'])
traversal.add('A')
traversal.add('B', dirs=['E', 'F'])
traversal.add('C', dirs=['G', 'H'])
traversal.add('D', dirs=['I', 'K'])
traversal.add('D', dirs=['J', 'L'])
traversal.add('E')
traversal.add('F')
traversal.add('G')
traversal.add('H')
traversal.add('I', dirs=['M', 'N'])
traversal.add('J', dirs=['O', 'P'])
traversal.add('K', dirs=['Q', 'R'])
traversal.add('L', dirs=['S'])
traversal.add('M')
traversal.add('N', dirs=['T'])
traversal.add('O')
traversal.add('P', dirs=['U'])
traversal.add('Q')
traversal.add('R', dirs=['V'])
traversal.add('S', dirs=['W'])
traversal.add('T')
traversal.add('U')
traversal.add('V')
traversal.add('W', dirs=['X'])
traversal.add('X')
parallels = set(('G', 'H', 'I', 'J', 'O', 'P', 'Q', 'R', 'U'))
def filter(current, subdirs):
return (current, [d for d in subdirs.dirs if d in parallels],
[d for d in subdirs.dirs if d not in parallels])
start, deps = traversal.compute_dependencies(filter)
self.assertEqual(start, ('X',))
self.maxDiff = None
self.assertEqual(deps, {
'A': ('',),
'B': ('A',),
'C': ('F',),
'D': ('G', 'H'),
'E': ('B',),
'F': ('E',),
'G': ('C',),
'H': ('C',),
'I': ('D',),
'J': ('D',),
'K': ('T', 'O', 'U'),
'L': ('Q', 'V'),
'M': ('I',),
'N': ('M',),
'O': ('J',),
'P': ('J',),
'Q': ('K',),
'R': ('K',),
'S': ('L',),
'T': ('N',),
'U': ('P',),
'V': ('R',),
'W': ('S',),
'X': ('W',),
})
self.assertEqual(list(traversal.traverse('', filter)),
['', 'A', 'B', 'E', 'F', 'C', 'G', 'H', 'D', 'I',
'M', 'N', 'T', 'J', 'O', 'P', 'U', 'K', 'Q', 'R',
'V', 'L', 'S', 'W', 'X'])
self.assertEqual(list(traversal.traverse('C', filter)),
['C', 'G', 'H'])
示例2: test_traversal_2
# 需要导入模块: from mozbuild.backend.recursivemake import RecursiveMakeTraversal [as 别名]
# 或者: from mozbuild.backend.recursivemake.RecursiveMakeTraversal import add [as 别名]
def test_traversal_2(self):
traversal = RecursiveMakeTraversal()
traversal.add('', dirs=['A', 'B', 'C'])
traversal.add('A')
traversal.add('B', dirs=['D', 'E', 'F'])
traversal.add('C', dirs=['G', 'H', 'I'])
traversal.add('D')
traversal.add('E')
traversal.add('F')
traversal.add('G')
traversal.add('H')
traversal.add('I')
start, deps = traversal.compute_dependencies()
self.assertEqual(start, ('I',))
self.assertEqual(deps, {
'A': ('',),
'B': ('A',),
'C': ('F',),
'D': ('B',),
'E': ('D',),
'F': ('E',),
'G': ('C',),
'H': ('G',),
'I': ('H',),
})
示例3: test_traversal_filter
# 需要导入模块: from mozbuild.backend.recursivemake import RecursiveMakeTraversal [as 别名]
# 或者: from mozbuild.backend.recursivemake.RecursiveMakeTraversal import add [as 别名]
def test_traversal_filter(self):
traversal = RecursiveMakeTraversal()
traversal.add('', dirs=['A', 'B', 'C'])
traversal.add('A')
traversal.add('B', dirs=['D', 'E', 'F'])
traversal.add('C', dirs=['G', 'H', 'I'])
traversal.add('D')
traversal.add('E')
traversal.add('F')
traversal.add('G')
traversal.add('H')
traversal.add('I')
def filter(current, subdirs):
if current == 'B':
current = None
return current, [], subdirs.dirs
start, deps = traversal.compute_dependencies(filter)
self.assertEqual(start, ('I',))
self.assertEqual(deps, {
'A': ('',),
'C': ('F',),
'D': ('A',),
'E': ('D',),
'F': ('E',),
'G': ('C',),
'H': ('G',),
'I': ('H',),
})
示例4: test_traversal
# 需要导入模块: from mozbuild.backend.recursivemake import RecursiveMakeTraversal [as 别名]
# 或者: from mozbuild.backend.recursivemake.RecursiveMakeTraversal import add [as 别名]
def test_traversal(self):
traversal = RecursiveMakeTraversal()
traversal.add('', dirs=['A', 'B', 'C'])
traversal.add('', dirs=['D'])
traversal.add('A')
traversal.add('B', dirs=['E', 'F'])
traversal.add('C', parallel=['G', 'H'])
traversal.add('D', parallel=['I'], dirs=['K'])
traversal.add('D', parallel=['J'], dirs=['L'])
traversal.add('E')
traversal.add('F')
traversal.add('G')
traversal.add('H')
traversal.add('I', dirs=['M', 'N'])
traversal.add('J', parallel=['O', 'P'])
traversal.add('K', parallel=['Q', 'R'])
traversal.add('L', dirs=['S'])
traversal.add('M')
traversal.add('N', dirs=['T'])
traversal.add('O')
traversal.add('P', parallel=['U'])
traversal.add('Q')
traversal.add('R', dirs=['V'])
traversal.add('S', dirs=['W'])
traversal.add('T')
traversal.add('U')
traversal.add('V')
traversal.add('W', dirs=['X'])
traversal.add('X')
start, deps = traversal.compute_dependencies()
self.assertEqual(start, ('X',))
self.assertEqual(deps, {
'A': ('',),
'B': ('A',),
'C': ('F',),
'D': ('G', 'H'),
'E': ('B',),
'F': ('E',),
'G': ('C',),
'H': ('C',),
'I': ('D',),
'J': ('D',),
'K': ('T', 'O', 'U'),
'L': ('Q', 'V'),
'M': ('I',),
'N': ('M',),
'O': ('J',),
'P': ('J',),
'Q': ('K',),
'R': ('K',),
'S': ('L',),
'T': ('N',),
'U': ('P',),
'V': ('R',),
'W': ('S',),
'X': ('W',),
})
self.assertEqual(list(traversal.traverse('')),
['', 'A', 'B', 'E', 'F', 'C', 'G', 'H', 'D', 'I',
'M', 'N', 'T', 'J', 'O', 'P', 'U', 'K', 'Q', 'R',
'V', 'L', 'S', 'W', 'X'])
self.assertEqual(list(traversal.traverse('C')),
['C', 'G', 'H'])
示例5: test_traversal
# 需要导入模块: from mozbuild.backend.recursivemake import RecursiveMakeTraversal [as 别名]
# 或者: from mozbuild.backend.recursivemake.RecursiveMakeTraversal import add [as 别名]
def test_traversal(self):
traversal = RecursiveMakeTraversal()
traversal.add("", dirs=["A", "B", "C"])
traversal.add("", dirs=["D"])
traversal.add("A")
traversal.add("B", dirs=["E", "F"])
traversal.add("C", dirs=["G", "H"])
traversal.add("D", dirs=["I", "K"])
traversal.add("D", dirs=["J", "L"])
traversal.add("E")
traversal.add("F")
traversal.add("G")
traversal.add("H")
traversal.add("I", dirs=["M", "N"])
traversal.add("J", dirs=["O", "P"])
traversal.add("K", dirs=["Q", "R"])
traversal.add("L", dirs=["S"])
traversal.add("M")
traversal.add("N", dirs=["T"])
traversal.add("O")
traversal.add("P", dirs=["U"])
traversal.add("Q")
traversal.add("R", dirs=["V"])
traversal.add("S", dirs=["W"])
traversal.add("T")
traversal.add("U")
traversal.add("V")
traversal.add("W", dirs=["X"])
traversal.add("X")
parallels = set(("G", "H", "I", "J", "O", "P", "Q", "R", "U"))
def filter(current, subdirs):
return (
current,
[d for d in subdirs.dirs if d in parallels],
[d for d in subdirs.dirs if d not in parallels],
)
start, deps = traversal.compute_dependencies(filter)
self.assertEqual(start, ("X",))
self.maxDiff = None
self.assertEqual(
deps,
{
"A": ("",),
"B": ("A",),
"C": ("F",),
"D": ("G", "H"),
"E": ("B",),
"F": ("E",),
"G": ("C",),
"H": ("C",),
"I": ("D",),
"J": ("D",),
"K": ("T", "O", "U"),
"L": ("Q", "V"),
"M": ("I",),
"N": ("M",),
"O": ("J",),
"P": ("J",),
"Q": ("K",),
"R": ("K",),
"S": ("L",),
"T": ("N",),
"U": ("P",),
"V": ("R",),
"W": ("S",),
"X": ("W",),
},
)
self.assertEqual(
list(traversal.traverse("", filter)),
[
"",
"A",
"B",
"E",
"F",
"C",
"G",
"H",
"D",
"I",
"M",
"N",
"T",
"J",
"O",
"P",
"U",
"K",
"Q",
"R",
"V",
"L",
"S",
"W",
"X",
#.........这里部分代码省略.........