本文整理汇总了Python中package.Package.open方法的典型用法代码示例。如果您正苦于以下问题:Python Package.open方法的具体用法?Python Package.open怎么用?Python Package.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类package.Package
的用法示例。
在下文中一共展示了Package.open方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_tests
# 需要导入模块: from package import Package [as 别名]
# 或者: from package.Package import open [as 别名]
def build_tests(self):
package = self.package
package_root = os.getcwd()
self.build_package(package, package_root)
download_dependencies(package.test_dependencies)
dependencies = []
for dependency in package.test_dependencies:
path = path_for_dependency(dependency)
os.chdir(path)
sub_package = Package.open()
os.chdir(os.path.join('..', '..'))
self.build_package(sub_package, path)
dependencies.append(sub_package)
dependencies.append(package)
for dependency in package.dependencies:
path = path_for_dependency(dependency)
os.chdir(path)
sub_package = Package.open()
os.chdir(os.path.join('..', '..'))
dependencies.append(sub_package)
sources = collect_sources(os.path.join(package_root, 'Tests'))
has_main = len([s for s in sources if s.endswith('/main.swift')]) > 0
if has_main:
self.build_cli(package.name + 'Tests', sources, dependencies)
else:
raise Exception('Tests is missing a main.swift')
示例2: Run
# 需要导入模块: from package import Package [as 别名]
# 或者: from package.Package import open [as 别名]
def Run(self):
"""Run the application ...
We first need to read in all of our package.* files.
Then we simply write them out with the correct method.
We pass a flag to check for installed packages.
"""
files_list = [
"/etc/portage/package.use",
"/etc/portage/package.unmask",
"/etc/portage/package.mask",
"/etc/portage/package.keywords",
"/etc/portage/package.license"
]
for name in files_list:
if not os.access(name, os.F_OK): continue
file = Package(name, self._destructive, self._sort, self._debug)
file.open()
if self._pretend:
output.verbose("%s:", name)
output.verbose(file.__unicode__())
else: file.write(self._reorganize)
file.close()
示例3: build_package
# 需要导入模块: from package import Package [as 别名]
# 或者: from package.Package import open [as 别名]
def build_package(self, package, package_root):
download_dependencies(package.dependencies)
dependencies = []
for dependency in package.dependencies:
path = path_for_dependency(dependency)
os.chdir(path)
sub_package = Package.open()
os.chdir(os.path.join('..', '..'))
self.build_package(sub_package, path)
dependencies.append(sub_package)
sources = collect_sources(os.path.join(package_root, 'Sources'))
has_main = len([s for s in sources if s.endswith('/main.swift')]) > 0
if has_main:
self.build_cli(package.name, sources, dependencies)
else:
self.build_library(package.name, sources, dependencies)