# HG changeset patch # User Jeff Hammel # Date 1327380070 28800 # Node ID 931bc3353f756bd2800da2dd453a60ff2f147078 # Parent 3efe894f9d798d38fe9671bfc40b1bcfd53b9a33 add simpleconf.py diff -r 3efe894f9d79 -r 931bc3353f75 python/simpleconf.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/simpleconf.py Mon Jan 23 20:41:10 2012 -0800 @@ -0,0 +1,6 @@ +def simpleconf(filename, sep='='): + assert os.path.exists(filename) + lines = [line.strip() for line in file(filename).readlines()] + lines = [line for line in lines if line and not line.startswith('#')] + assert not [line for line in lines if sep not in line] + return dict([line.split(sep, 1) for line in lines])