rootDir = xxx

This commit is contained in:
David Rose 2009-12-27 01:25:46 +00:00
parent 2891b585b0
commit a53c0b1b59

View File

@ -10,7 +10,7 @@ class HostInfo:
class in the core API. """ class in the core API. """
def __init__(self, hostUrl, appRunner = None, hostDir = None, def __init__(self, hostUrl, appRunner = None, hostDir = None,
asMirror = False, perPlatform = None): rootDir = None, asMirror = False, perPlatform = None):
""" You must specify either an appRunner or a hostDir to the """ You must specify either an appRunner or a hostDir to the
HostInfo constructor. HostInfo constructor.
@ -31,10 +31,14 @@ class HostInfo:
platform-specific directory name. If asMirror is True, then platform-specific directory name. If asMirror is True, then
the default is perPlatform = True. """ the default is perPlatform = True. """
assert appRunner or hostDir assert appRunner or rootDir or hostDir
self.hostUrl = hostUrl self.hostUrl = hostUrl
self.appRunner = appRunner self.appRunner = appRunner
self.rootDir = rootDir
if rootDir is None and appRunner:
self.rootDir = appRunner.rootDir
self.hostDir = hostDir self.hostDir = hostDir
self.asMirror = asMirror self.asMirror = asMirror
self.perPlatform = perPlatform self.perPlatform = perPlatform
@ -385,7 +389,7 @@ class HostInfo:
if hostDirBasename: if hostDirBasename:
# If the contents.xml specified a host_dir parameter, use # If the contents.xml specified a host_dir parameter, use
# it. # it.
self.hostDir = self.appRunner.rootDir + '/hosts' self.hostDir = self.rootDir + '/hosts'
for component in hostDirBasename.split('/'): for component in hostDirBasename.split('/'):
if component: if component:
if component[0] == '.': if component[0] == '.':
@ -443,4 +447,4 @@ class HostInfo:
md.hashString(self.hostUrl) md.hashString(self.hostUrl)
hostDir += md.asHex()[:keepHash * 2] hostDir += md.asHex()[:keepHash * 2]
self.hostDir = Filename(self.appRunner.rootDir, hostDir) self.hostDir = Filename(self.rootDir, hostDir)