direct.p3d.HostInfo
from direct.p3d.HostInfo import HostInfo
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 HostInfo(hostUrl, appRunner=None, hostDir=None, rootDir=None, asMirror=False, perPlatform=None)[source]
Bases:
object
This class represents a particular download host serving up Panda3D packages. It is the Python equivalent of the P3DHost class in the core API.
- __init__(self, hostUrl, appRunner=None, hostDir=None, rootDir=None, asMirror=False, perPlatform=None)[source]
You must specify either an appRunner or a hostDir to the HostInfo constructor.
If you pass asMirror = True, it means that this HostInfo object is to be used to populate a “mirror” folder, a duplicate (or subset) of the contents hosted by a server. This means when you use this HostInfo to download packages, it will only download the compressed archive file and leave it there. At the moment, mirror folders do not download old patch files from the server.
If you pass perPlatform = True, then files are unpacked into a platform-specific directory, which is appropriate when you might be downloading multiple platforms. The default is perPlatform = False, which means all files are unpacked into the host directory directly, without an intervening platform-specific directory name. If asMirror is True, then the default is perPlatform = True.
Note that perPlatform is also restricted by the individual package’s specification.
- deletePackages(self, packages)[source]
Removes all of the indicated packages from the disk, uninstalling them and deleting all of their files. The packages parameter must be a list of one or more PackageInfo objects, for instance as returned by getPackage(). Returns the list of packages that were NOT found.
- downloadContentsFile(self, http, redownload=False, hashVal=None)[source]
Downloads the contents.xml file for this particular host, synchronously, and then reads it. Returns true on success, false on failure. If hashVal is not None, it should be a HashVal object, which will be filled with the hash from the new contents.xml file.
- freshenFile(self, http, fileSpec, localPathname)[source]
Ensures that the localPathname is the most current version of the file defined by fileSpec, as offered by host. If not, it downloads a new version on-the-spot. Returns true on success, false on failure.
- getAllPackages(self, includeAllPlatforms=False)[source]
Returns a list of all available packages provided by this host.
- getPackage(self, name, version, platform=None)[source]
Returns a PackageInfo that matches the indicated name and version and the indicated platform or the current runtime platform, if one is provided by this host, or None if not.
- getPackages(self, name=None, platform=None)[source]
Returns a list of PackageInfo objects that match the indicated name and/or platform, with no particular regards to version. If name is None, all packages are returned.
- hasCurrentContentsFile(self)[source]
Returns true if a contents.xml file has been successfully read for this host and is still current, false otherwise.
- notify = <direct.directnotify.Notifier.Notifier object>
- readContentsFile(self, tempFilename=None, freshDownload=False)[source]
Reads the contents.xml file for this particular host, once it has been downloaded into the indicated temporary file. Returns true on success, false if the contents file is not already on disk or is unreadable.
If tempFilename is specified, it is the filename read, and it is copied the file into the standard location if it’s not there already. If tempFilename is not specified, the standard filename is read if it is known.