def filter(self): if self.all: logger.info("No filter applied") self.filteredList = self.fileList elif not self.doctype is None: logger.log("Selecting DocType files...") self.filteredList = util.filterDocType(self.fileList, self.doctype) else: logger.log("Filtering file types...") self.filteredList = util.filterList(self.fileList) for itempath in self.filteredList: item = util.getFileType(itempath) if item not in self.extList: self.extList.append(item)
def check(self): if self.key == 'master': url = RELO_MASTER_VERSION_URL elif self.key == 'develop': url = RELO_DEVELOP_VERSION_URL remote = urllib.urlopen(url) self.remoteVersion = remote.read() try: float(self.remoteVersion) except: logger.error('Could not determine remote version.') sys.exit() logger.info('Local Version - ' + self.localVersion) logger.info('Remote Version - ' + self.remoteVersion) if float(self.remoteVersion) > float(self.localVersion): logger.log("Found new version: " + self.remoteVersion) return True else: logger.head("Already Up-To-Date") return False
########## INDEX ########## elif results.which == 'index': if results.meta: meta = MetaIndex(results.directory, results.hidden) meta.setUpProject('meta') meta.listProject() meta.run() elif results.content: inverted = InvertedIndex(results.directory, results.hidden) inverted.setUpProject('search') inverted.listProject() inverted.run() else: line = "Relo: Meta + Search Index" logger.head(line) logger.log('-' * len(line)) sTime = time.time() meta = MetaIndex(results.directory, results.hidden) meta.listProject() meta.run() inverted = InvertedIndex(results.directory, results.hidden) inverted.setUpProject('meta:::search') ### make index more modular and fix this nasty code inverted.run() eTime = time.time() dTime = eTime - sTime logger.info("(Meta+Search: %0.2fs)" % (dTime)) ########## STATS ########## elif results.which == 'stats': stats = Stats(results.directory, results.module, results.hidden) if stats.check(): stats.go()
def fileNameSearch(fileList, key): for itempath in fileList: item = os.path.basename(itempath) if not item.find(key) == -1: logger.log("Found: " + itempath)