def find_volume(opts=None, pwd=None): vdb = None print list(confparse.find_config_path("git", pwd.location.path)) for path in confparse.find_config_path("cllct", pwd.location.path): vdb = os.path.join(path, 'volume.db') if os.path.exists(vdb): break if not vdb: if opts.init: pass print vdb yield vdb
def find_id(clss, *paths): prefixes = confparse.name_prefixes + ( '.'+clss.DOTNAME+'/', ) return list(confparse.find_config_path(clss.DOTID, paths=list(paths), prefixes=prefixes, suffixes=['.id'] ))
def __init__( self, staticcontext ): pathiter = confparse.find_config_path( staticcontext.name, staticcontext.pwd )
def find_meta(clss, *paths): return list(confparse.find_config_path(clss.DOTNAME, paths=list(paths), prefixes=confparse.name_prefixes, suffixes=[''] ))
# self.voldir = voldir # self.shelve = shelve.open( os.path.join( voldir, 'fscard.db' ) ) if __name__ == "__main__": argv = list(sys.argv) script_name = argv.pop(0) size_threshold = 14 * 1024 ** 6 if argv: path = argv.pop() else: path = os.getcwd() fscard_dbref = list(confparse.find_config_path("fscard", path=path, suffixes=[".db"])) if not fscard_dbref: print "No fscard file" sys.exit(1) shelve = shelve.open(fscard_dbref[0], "r") for k in shelve: print k, shelve.get(k) sys.exit(0) sitefiles = list(confparse.find_config_path("Sitefile", suffixes=[".json", ".yaml", ".py", ".js"])) if sitefiles: settings = confparse.load_path(sitefiles[0], confparse.YAMLValues).sitefile else: homesitefile = os.path.expanduser("~/Sitefile.yaml") settings = confparse.load_path(homesitefile, confparse.YAMLValues).sitefile