Panda3D
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
HostInfo Class Reference

Public Member Functions

def __init__
 
def deletePackages
 
def downloadContentsFile
 
def freshenFile
 
def getAllPackages
 
def getPackage
 
def getPackages
 
def hasCurrentContentsFile
 
def readContentsFile
 
def readHostXml
 
def redownloadContentsFile
 

Public Attributes

 altHosts
 
 appRunner
 
 asMirror
 
 contentsExpiration
 
 contentsSpec
 
 descriptiveName
 
 downloadUrlPrefix
 
 hasContentsFile
 
 hostDir
 
 hostUrl
 
 hostUrlPrefix
 
 mirrors
 
 packages
 
 perPlatform
 
 rootDir
 

Static Public Attributes

tuple notify = directNotify.newCategory("HostInfo")
 

Detailed Description

This class represents a particular download host serving up
Panda3D packages.  It is the Python equivalent of the P3DHost
class in the core API. 

Constructor & Destructor Documentation

def __init__ (   self,
  hostUrl,
  appRunner = None,
  hostDir = None,
  rootDir = None,
  asMirror = False,
  perPlatform = None 
)
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.  

Member Function Documentation

def deletePackages (   self,
  packages 
)
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. 
def downloadContentsFile (   self,
  http,
  redownload = False,
  hashVal = None 
)
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.
def freshenFile (   self,
  http,
  fileSpec,
  localPathname 
)
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. 
def getAllPackages (   self,
  includeAllPlatforms = False 
)
Returns a list of all available packages provided by this
host. 
def getPackage (   self,
  name,
  version,
  platform = None 
)
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. 
def getPackages (   self,
  name = None,
  platform = None 
)
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. 
def hasCurrentContentsFile (   self)
Returns true if a contents.xml file has been successfully
read for this host and is still current, false otherwise. 
def readContentsFile (   self,
  tempFilename = None,
  freshDownload = False 
)
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. 
def readHostXml (   self,
  xhost 
)
Reads a <host> or <alt_host> entry and applies the data to
this object. 
def redownloadContentsFile (   self,
  http 
)
Downloads a new contents.xml file in case it has changed.
Returns true if the file has indeed changed, false if it has
not. 

Member Data Documentation

altHosts
appRunner
asMirror
contentsExpiration
contentsSpec
descriptiveName
downloadUrlPrefix
hasContentsFile
hostDir
hostUrl
hostUrlPrefix
mirrors
tuple notify = directNotify.newCategory("HostInfo")
static
packages
perPlatform
rootDir