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.

Inheritance diagram

Inheritance diagram of direct.p3d.FileSpec

class FileSpec[source]

Bases: object

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)[source]

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)[source]

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)[source]

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)[source]

Reads the file information from the indicated XML element.

quickVerify(self, packageDir=None, pathname=None, notify=None, correctSelf=False)[source]

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)[source]

Reads the hash only from the indicated pathname.

storeMiniXml(self, xelement)[source]

Adds the just the “mini” file information–size and hash–to the indicated XML element.

storeXml(self, xelement)[source]

Adds the file information to the indicated XML element.