# direct.p3d.PatchMaker¶

from direct.p3d.PatchMaker import PatchMaker


Deprecated since version 1.10.0: The p3d packaging system has been replaced with the new setuptools-based system. See the Distributing Panda3D Applications manual section.

Inheritance diagram

class PatchMaker(installDir)[source]

Bases: object

This class will operate on an existing package install directory, as generated by the Packager, and create patchfiles between versions as needed. It is also used at runtime, to apply the downloaded patches.

class Package(packageDesc, patchMaker, xpackage=None)[source]

Bases: object

This is a particular package. This contains all of the information needed to reconstruct the package’s desc file.

__init__(self, packageDesc, patchMaker, xpackage=None)[source]
getBaseKey(self)[source]

Returns the key to locate the “base” or oldest version of this package.

getCurrentKey(self)[source]

Returns the key to locate the current version of this package.

getGenericKey(self, fileSpec)[source]

Returns the key that has the indicated hash.

getTopKey(self)[source]

Returns the key to locate the “top” or newest version of this package.

readDescFile(self, doProcessing=False)[source]

Reads the existing package.xml file and stores it in this class for later rewriting. if doProcessing is true, it may massage the file and the directory contents in preparation for building patches. Returns true on success, false on failure.

writeDescFile(self)[source]

Rewrites the desc file with the new patch information.

class PackageVersion(packageName, platform, version, hostUrl, file)[source]

Bases: object

A specific patch version of a package. This is not just the package’s “version” string; it also corresponds to the particular patch version, which increments independently of the “version”.

__init__(self, packageName, platform, version, hostUrl, file)[source]
applyPatch(self, origFile, patchFilename)[source]

Applies the named patch to the indicated original file, storing the results in a temporary file, and returns that temporary Filename. Returns None on failure.

cleanup(self)[source]
getFile(self)[source]

Returns the Filename of the archive file associated with this version. If the file doesn’t actually exist on disk, a temporary file will be created. Returns None if the file can’t be recreated.

getNext(self, package)[source]

Gets the next patch in the chain towards this package.

getPatchChain(self, startPv, alreadyVisited=[])[source]

Returns a list of patches that, when applied in sequence to the indicated PackageVersion object, will produce this PackageVersion object. Returns None if no chain can be found.

getRecreateFilePlan(self, alreadyVisited=[])[source]

Returns the tuple (startFile, startPv, plan), describing how to recreate the archive file for this version. startFile and startPv is the Filename and packageVersion of the file to start with, and plan is a list of tuples (patchfile, pv), listing the patches to apply in sequence, and the packageVersion object associated with each patch. Returns (None, None, None) if there is no way to recreate this archive file.

class Patchfile(package)[source]

Bases: object

A single patchfile for a package.

__init__(self, package)[source]
fromFile(self, packageDir, patchFilename, sourceFile, targetFile)[source]

Creates the data structures from an existing patchfile on disk.

getSourceKey(self)[source]

Returns the key for locating the package that this patchfile can be applied to.

getTargetKey(self)[source]

Returns the key for locating the package that this patchfile will generate.

loadXml(self, xpatch)[source]

Reads the data structures from an xml file.

makeXml(self, package)[source]
__init__(self, installDir)[source]
buildPatch(self, v1, v2, package, patchFilename)[source]

Builds a patch from PackageVersion v1 to PackageVersion v2, and stores it in patchFilename.pz. Returns true on success, false on failure.

buildPatchChains(self)[source]

Builds up the chains of PackageVersions and the patchfiles that connect them.

buildPatchFile(self, origFilename, newFilename, patchFilename, printOrigName, printNewName)[source]

Creates a patch file from origFilename to newFilename, storing the result in patchFilename. Returns true on success, false on failure.

buildPatches(self, packageNames=None)[source]

Makes the patches required in a particular directory structure on disk. If packageNames is None, this makes patches for all packages; otherwise, it should be a list of package name strings, limiting the set of packages that are processed.

cleanup(self)[source]

Should be called on exit to remove temporary files and such created during processing.

getPackageVersion(self, key)[source]

Returns a shared PackageVersion object for the indicated key.

getPatchChainToCurrent(self, descFilename, fileSpec)[source]

Reads the package defined in the indicated desc file, and constructs a patch chain from the version represented by fileSpec to the current version of this package, if possible. Returns the patch chain if successful, or None otherwise.

processAllPackages(self)[source]

Walks through the list of packages, and builds missing patches for each one.

processPackage(self, package)[source]

Builds missing patches for the indicated package.

processSomePackages(self, packageNames)[source]

Builds missing patches only for the named packages.

readContentsFile(self)[source]

Reads the contents.xml file at the beginning of processing.

readPackageDescFile(self, descFilename)[source]

Reads a desc file associated with a particular package, and adds the package to self.packages. Returns the Package object, or None on failure.

recordPatchfile(self, patchfile)[source]

Adds the indicated patchfile to the patch chains.

writeContentsFile(self)[source]

Writes the contents.xml file at the end of processing.