本文整理汇总了Python中package.Package.addDependencies方法的典型用法代码示例。如果您正苦于以下问题:Python Package.addDependencies方法的具体用法?Python Package.addDependencies怎么用?Python Package.addDependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类package.Package
的用法示例。
在下文中一共展示了Package.addDependencies方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addPackage
# 需要导入模块: from package import Package [as 别名]
# 或者: from package.Package import addDependencies [as 别名]
def addPackage(self,name,dependencies = []): #may or may not have dependencies
#check if package already there
if name in self.packages: return False
#make sure dependencies already exist
for dependency in dependencies:
if dependency not in self.packages:
return False
#iterate through dependencies and make connection to current package
for dependency in dependencies:
self.packages[dependency].used_by.append(dependency)
#if all is well, add package
newPackage = Package(name)
canAdd = newPackage.addDependencies(dependencies)
if not canAdd:
return False
self.packages[name] = newPackage
return True