def unTar(self, tarFile): basename = os.path.basename(tarFile) extractPath = self.buildDir Printer.printString("Preparing to extract %s" % (tarFile)) tfile = tarfile.open(tarFile) conf = "" #find the configure file for fil in tfile.getnames(): if fil.endswith('configure'): conf = fil if tarfile.is_tarfile(tarFile): tfile.extractall(extractPath) else: Printer.printString(theTarFile + " is not a tarfile.") return os.path.dirname(os.path.join(extractPath, conf))
def download(self, url, dest): destination = os.path.join(GlobalSettings.downloadCache, dest) if os.path.exists(destination): Printer.printString("Using local copy of %s" % dest) else: if not os.path.exists(GlobalSettings.downloadCache): os.mkdir(GlobalSettings.downloadCache) f = open(destination,'wb+') Printer.printString("Downloading %s" % (url)) f.write(urllib2.urlopen(url).read()) Printer.printString("Finished. File downloaded to %s" % destination) f.close() if not os.path.exists(self.buildDir): os.mkdir(self.buildDir) linkFile = os.path.join(self.buildDir, dest) if os.path.exists(linkFile): os.remove(linkFile) os.symlink(destination, linkFile) return linkFile
ps("\n############################################") ps("# #") ps("# Welcome to CannedZen Stack Manager #") ps("# #") ps("############################################") ps("\nYour install Path is %s" % GlobalSettings.getInstallPath()) ps("Your virtualenv Path is %s\n" % GlobalSettings.getVirtualEnvPath()) if options: for flag, val in options.__dict__.items(): if flag == 'searchstring' and val: ps("\nSearching for : %s" % val) ps("----------------------------") found = False for package, packageClass in Admin.getPackages().items(): if val in package: Printer.increaseLevel() ps(fw("%s (%s)" % (package, packageClass.version), packageClass.toolkit_usage, 40)) found = True if not found: Printer.returnToBase() ps("No Packages Found", " ") if flag == 'install' and val: installing = set() #container for the packages that need to be installed dependencies = {} ps("\nPreparing to install %s" % ', '.join(val)) ps("----------------------------") Printer.increaseLevel() for package in val: if Admin.packageExists(package): packageClass = Admin.getPackage(package)