本文整理汇总了Python中rapuma.core.tools.Tools.fixExecutables方法的典型用法代码示例。如果您正苦于以下问题:Python Tools.fixExecutables方法的具体用法?Python Tools.fixExecutables怎么用?Python Tools.fixExecutables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rapuma.core.tools.Tools
的用法示例。
在下文中一共展示了Tools.fixExecutables方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProjData
# 需要导入模块: from rapuma.core.tools import Tools [as 别名]
# 或者: from rapuma.core.tools.Tools import fixExecutables [as 别名]
#.........这里部分代码省略.........
pid = pid.split('.')[0]
except :
archName = pid + '.rapuma'
archSource = ''
archTarget = ''
userArchives = ''
# First look for the archive that is to be restored
if sourcePath :
if os.path.isdir(sourcePath) :
archSource = os.path.join(sourcePath, archName)
elif os.path.isdir(self.userConfig['Resources']['archive']) :
userArchives = self.userConfig['Resources']['archive']
archSource = os.path.join(userArchives, archName)
else :
self.tools.terminal('\nError: The path (or name) given is not valid: [' + archSource + ']\n')
self.tools.dieNow()
# Now set the target params
if targetPath :
if not os.path.isdir(targetPath) :
self.tools.terminal('\nError: The path given is not valid: [' + targetPath + ']\n')
self.tools.dieNow()
else :
archTarget = os.path.join(targetPath, pid)
# If we made it this far, extract the archive
with zipfile.ZipFile(archSource, 'r') as myzip :
myzip.extractall(archTarget)
# Permission for executables is lost in the zip, fix it here
for folder in ['Scripts', os.path.join('Macros', 'User')] :
self.tools.fixExecutables(os.path.join(archTarget, folder))
# FIXME: This will need some work
# Add project to local Rapuma project registry
# To do this we need to open up the restored project config file
# and pull out some settings.
local = ProjLocal(pid)
pc = Config(pid)
log = ProjLog(pid)
aProject = Project(pid, self.gid)
# import pdb; pdb.set_trace()
# Finish here
self.tools.terminal('\nRapuma archive [' + pid + '] has been restored to: ' + archTarget + '\n')
###############################################################################
########################### Backup Project Functions ##########################
###############################################################################
####################### Error Code Block Series = 3000 ########################
###############################################################################
def cullBackups (self, maxBak, bakDir) :
'''Remove any excess backups from the backup folder in
this project.'''
# Get number of maximum backups to store
maxStoreBackups = int(maxBak)
if not maxStoreBackups or maxStoreBackups == 0 :
maxStoreBackups = 1
# Build the cullList