Mercurial > hg > silvermirror
changeset 40:d081ca2e8696
py35
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 20 Feb 2017 15:02:50 -0800 |
parents | 9e21b4fbd8b3 |
children | c9d222b85e63 |
files | silvermirror/unify.py silvermirror/utils.py |
diffstat | 2 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/silvermirror/unify.py Tue May 12 18:33:30 2015 -0700 +++ b/silvermirror/unify.py Mon Feb 20 15:02:50 2017 -0800 @@ -13,8 +13,9 @@ from martini.config import ConfigMunger from pkg_resources import iter_entry_points from pprint import pprint -from utils import home -from utils import ip_addresses +from .utils import home +from .utils import ip_addresses + def make_config(filename): # XXX needed? @@ -22,6 +23,8 @@ def read_config(filename): + """read configuration `filename`""" + config = ConfigMunger(filename).dict() ### main configuration
--- a/silvermirror/utils.py Tue May 12 18:33:30 2015 -0700 +++ b/silvermirror/utils.py Mon Feb 20 15:02:50 2017 -0800 @@ -2,11 +2,14 @@ import netifaces import os +import sys + def home(): # XXX needed? better way of doing? return os.environ['HOME'] + def ip_addresses(): """dictionary of ip4 addresses for the machine""" interfaces = [] @@ -22,6 +25,11 @@ for i in interfaces ]) -if __name__ == '__main__': + +def main(args=sys.argv[1:]): for name, value in sorted(ip_addresses().items()): - print '%s : %s' % (name, value) + print ('%s : %s' % (name, value)) + + +if __name__ == '__main__': + main()