本文整理汇总了Python中profile.Profile.postprocess方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.postprocess方法的具体用法?Python Profile.postprocess怎么用?Python Profile.postprocess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类profile.Profile
的用法示例。
在下文中一共展示了Profile.postprocess方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_package
# 需要导入模块: from profile import Profile [as 别名]
# 或者: from profile.Profile import postprocess [as 别名]
def process_package(self, package):
failure_count = 0
def staging_harness(path, func, failure_count=failure_count):
def relocate_to_profile(token):
if token.find(package.staged_prefix) == -1 and token.find(package.staged_profile) == -1:
newtoken = token.replace(
package.package_prefix, package.staged_profile)
else:
newtoken = token.replace(
package.staged_prefix, package.staged_profile)
if newtoken != token:
package.trace('%s:\n\t%s\t->\t%s' %
(os.path.basename(path), token, newtoken))
return newtoken
if (path.endswith('.release')):
error('Staging backup exists in dir we''re trying to stage: %s' % path)
backup = path + '.release'
shutil.copy2(path, backup)
try:
trace('Staging %s' % path)
func(path, relocate_to_profile)
if os.path.exists(path + '.stage'):
os.remove(path)
shutil.move(path + '.stage', path)
shutil.copystat(backup, path)
except CommandException as e:
package.rm_if_exists(path)
shutil.copy2(backup, path)
package.rm(backup)
warn('Staging failed for %s' % os.path.basename(path))
error(str(e))
failure_count = failure_count + 1
if failure_count > 10:
error('Possible staging issue, >10 staging failures')
extra_files = [os.path.join(package.staged_prefix, expand_macros(file, package))
for file in package.extra_stage_files]
procs = []
if package.name in self.debug_info:
procs.append(self.generate_dsyms())
procs.append(self.stage_textfiles(harness=staging_harness,
match=match_stageable_text, extra_files=extra_files))
procs.append(self.stage_binaries(
harness=staging_harness, match=match_stageable_binary))
Profile.postprocess(self, procs, package.staged_prefix)
示例2: process_release
# 需要导入模块: from profile import Profile [as 别名]
# 或者: from profile.Profile import postprocess [as 别名]
def process_release(self, directory):
# validate staged install
# TODO: move to end of '--build' instead of at the beginning of '--package'
# unprotect_dir (self.staged_prefix, recursive = True)
# Profile.postprocess (self, [self.validate_rpaths (match = self.match_stageable_binary),
# self.validate_symlinks (match = self.match_symlinks)],
# self.staged_prefix)
unprotect_dir(directory, recursive=True)
def destaging_harness(backup, func):
path = backup[0:-len('.release')]
trace(path)
def relocate_for_release(token):
newtoken = token.replace(self.staged_prefix, self.prefix)
if newtoken != token:
trace('%s:\n\t%s\t->\t%s' %
(os.path.basename(path), token, newtoken))
return newtoken
try:
trace('Destaging %s' % path)
func(path, relocate_for_release)
if os.path.exists(path + '.stage'):
os.remove(path)
shutil.move(path + '.stage', path)
shutil.copystat(backup, path)
os.remove(backup)
except Exception as e:
warn ('Critical: Destaging failed for ''%s''' % path)
raise
procs = [self.stage_textfiles(harness=destaging_harness, match=match_text),
self.stage_binaries(harness=destaging_harness, match=match_stageable_binary)]
Profile.postprocess(self, procs, directory,
lambda l: l.endswith('.release'))