def __findPatchChain(self, fileSpec): """ Finds the chain of patches that leads from the indicated patch version to the current patch version. If found, constructs an installPlan that represents the steps of the patch installation; otherwise, returns None. """ from direct.p3d.PatchMaker import PatchMaker patchMaker = PatchMaker(self.getPackageDir()) patchChain = patchMaker.getPatchChainToCurrent(self.descFileBasename, fileSpec) if patchChain is None: # No path. patchMaker.cleanup() return None plan = [] for patchfile in patchChain: downloadSize = patchfile.file.size func = lambda step, fileSpec=patchfile.file: self.__downloadFile( step, fileSpec, allowPartial=True) step = self.InstallStep(func, downloadSize, self.downloadFactor, 'download') plan.append(step) patchSize = patchfile.targetFile.size func = lambda step, patchfile=patchfile: self.__applyPatch( step, patchfile) step = self.InstallStep(func, patchSize, self.patchFactor, 'patch') plan.append(step) patchMaker.cleanup() return plan
def __findPatchChain(self, fileSpec): """ Finds the chain of patches that leads from the indicated patch version to the current patch version. If found, constructs an installPlan that represents the steps of the patch installation; otherwise, returns None. """ from direct.p3d.PatchMaker import PatchMaker patchMaker = PatchMaker(self.getPackageDir()) patchChain = patchMaker.getPatchChainToCurrent(self.descFileBasename, fileSpec) if patchChain is None: # No path. patchMaker.cleanup() return None plan = [] for patchfile in patchChain: downloadSize = patchfile.file.size func = lambda step, fileSpec = patchfile.file: self.__downloadFile(step, fileSpec, allowPartial = True) step = self.InstallStep(func, downloadSize, self.downloadFactor, 'download') plan.append(step) patchSize = patchfile.targetFile.size func = lambda step, patchfile = patchfile: self.__applyPatch(step, patchfile) step = self.InstallStep(func, patchSize, self.patchFactor, 'patch') plan.append(step) patchMaker.cleanup() return plan
opts, args = getopt.getopt(sys.argv[1:], 'i:h') except getopt.error, msg: usage(1, msg) installDir = None for opt, arg in opts: if opt == '-i': installDir = Filename.fromOsSpecific(arg) elif opt == '-h': usage(0) else: print 'illegal option: ' + arg sys.exit(1) packageNames = args if not installDir: installDir = Filename('install') if not packageNames: # "None" means all packages. packageNames = None pm = PatchMaker(installDir) pm.buildPatches(packageNames=packageNames) # An explicit call to exit() is required to exit the program, when # this module is packaged in a p3d file. sys.exit(0)
opts, args = getopt.getopt(sys.argv[1:], 'i:h') except getopt.error, msg: usage(1, msg) installDir = None for opt, arg in opts: if opt == '-i': installDir = Filename.fromOsSpecific(arg) elif opt == '-h': usage(0) else: print 'illegal option: ' + arg sys.exit(1) packageNames = args if not installDir: installDir = Filename('install') if not packageNames: # "None" means all packages. packageNames = None pm = PatchMaker(installDir) pm.buildPatches(packageNames = packageNames) # An explicit call to exit() is required to exit the program, when # this module is packaged in a p3d file. sys.exit(0)