def merge(self, package, dir): source = Path(dir) / "image" source.checkdir() target = package.basedir if target.exists() and not target.isdir(): raise Exception("'%s' is not a directory" % (target, )) if not target.exists(): target.mkdir(077) target = package.installdir if target.exists(): raise Exception("'%s' already exists" % (target, )) source.move(target)
def __init__(self, basedir = None, installdir = "installed", shareddir = "shared", *args, **kw): print kw super(SoftwareAdapter, self).__init__(baseclass = SoftwarePackage, *args, **kw) if not basedir: basedir = self.get_homedir() else: basedir = Path(basedir) if not basedir.isabs(): raise ValueError("Need an absolute path for basedir, not " + str(basedir)) installdir = Path(installdir) shareddir = Path(shareddir) if not installdir.isabs(): installdir = basedir / installdir if not shareddir.isabs(): shareddir = basedir / shareddir self.basedir = basedir self.installdir = installdir self.shareddir = shareddir basedir.checkdir() shareddir.checkdir() installdir.checkdir()