def __reallyload(self): havelocal=self.__fsclass==vfs.LocalFS docmount=get_product_path(self.name) if havelocal: newfs=vfs.LocalFS(os.path.join('%s/' % self.file, self.docroot)) libdir=normpath2('%s/%s' % (self.file, self.libs)) if os.path.exists(libdir) and libdir not in sys.path: sys.path.append(libdir) # if using Python 2.3 or better, using zipimport elif self.format=='.zip' and sys.version_info >=(2,3): libdir='%s/%s' % (self.file, self.libs) sys.path.append(libdir) newfs=self.__fsclass(self.file, root=self.docroot) else: newfs=self.__fsclass(self.file, root=self.docroot) libfs=self.__fsclass(self.file, root=self.libs) # if the libfs is empty, don't bother installing it if libfs.listdir('/'): k=vfs.registerFS(libfs, self.name) vfs.importer.install() sys.path.append('vfs://<%s>/' % k) self.__targetfs.mount(newfs, ProductMountPoint(docmount)) # this will import services even if they are not contained in # the product itself; I'm unclear at this point whether that is # good or not for service in self.services: __import__(service)
def __reallyload(self): havelocal = self.__fsclass == vfs.LocalFS docmount = get_product_path(self.name) if havelocal: newfs = vfs.LocalFS(os.path.join('%s/' % self.file, self.docroot)) libdir = normpath2('%s/%s' % (self.file, self.libs)) if os.path.exists(libdir) and libdir not in sys.path: sys.path.append(libdir) # if using Python 2.3 or better, using zipimport elif self.format == '.zip' and sys.version_info >= (2, 3): libdir = '%s/%s' % (self.file, self.libs) sys.path.append(libdir) newfs = self.__fsclass(self.file, root=self.docroot) else: newfs = self.__fsclass(self.file, root=self.docroot) libfs = self.__fsclass(self.file, root=self.libs) # if the libfs is empty, don't bother installing it if libfs.listdir('/'): k = vfs.registerFS(libfs, self.name) vfs.importer.install() sys.path.append('vfs://<%s>/' % k) self.__targetfs.mount(newfs, ProductMountPoint(docmount)) # this will import services even if they are not contained in # the product itself; I'm unclear at this point whether that is # good or not for service in self.services: __import__(service)
def __init__(self, product_file, targetfs=Cfg.documentRootFS): isdir=os.path.isdir(product_file) if not isdir: m=_pRE.match(product_file) if not m: raise ValueError, "not a product file: %s" % product_file self.format=m.group(2) self.name=os.path.basename(m.group(1)) else: self.format=DIRECTORY_FORMAT self.name=os.path.basename(product_file) self.file=product_file self.__fsclass=_fsmap[self.format] self.__targetfs=targetfs self.__fsname=vfs.registerFS(targetfs, 'documentRootFS') self.__readManifest()
def __init__(self, product_file, targetfs=Cfg.documentRootFS): isdir = os.path.isdir(product_file) if not isdir: m = _pRE.match(product_file) if not m: raise ValueError, "not a product file: %s" % product_file self.format = m.group(2) self.name = os.path.basename(m.group(1)) else: self.format = DIRECTORY_FORMAT self.name = os.path.basename(product_file) self.file = product_file self.__fsclass = _fsmap[self.format] self.__targetfs = targetfs self.__fsname = vfs.registerFS(targetfs, 'documentRootFS') self.__readManifest()