from direct.p3d.FileSpec import FileSpec
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.
- class FileSpec
This class represents a disk file whose hash and size etc. were read from an xml file. This class provides methods to verify whether the file on disk matches the version demanded by the xml.
- checkHash(self, packageDir, pathname, st)
Returns true if the file has the expected md5 hash, false otherwise. As a side effect, stores a FileSpec corresponding to the on-disk file in self.actualFile.
- fromFile(self, packageDir, filename, pathname=None, st=None)
Reads the file information from the indicated file. If st is supplied, it is the result of os.stat on the filename.
- fullVerify(self, packageDir=None, pathname=None, notify=None)
Performs a more thorough test to ensure the file has not been modified. This test is less vulnerable to malicious attacks, since it reads and verifies the entire file.
Returns true if it is intact, false if it needs to be redownloaded.
- loadXml(self, xelement)
Reads the file information from the indicated XML element.
- quickVerify(self, packageDir=None, pathname=None, notify=None, correctSelf=False)
Performs a quick test to ensure the file has not been modified. This test is vulnerable to people maliciously attempting to fool the program (by setting datestamps etc.).
if correctSelf is True, then any discrepency is corrected by updating the appropriate fields internally, making the assumption that the file on disk is the authoritative version.
Returns true if it is intact, false if it is incorrect. If correctSelf is true, raises OSError if the self-update is impossible (for instance, because the file does not exist).
- readHash(self, pathname)
Reads the hash only from the indicated pathname.
- storeMiniXml(self, xelement)
Adds the just the “mini” file information–size and hash–to the indicated XML element.
- storeXml(self, xelement)
Adds the file information to the indicated XML element.