diff --git a/commands.py b/commands.py index f3e03ed..b80d565 100644 --- a/commands.py +++ b/commands.py @@ -32,6 +32,8 @@ from nicos.commands import helparglist, usercommand from nicos.commands.basic import AddSetup, CreateAllDevices, CreateDevice from nicos.devices.secop.devices import get_attaching_devices from nicos_sinq.frappy_sinq.devices import applyAliasConfig +from servicemanager import FrappyManager + home = expanduser('~') if home not in sys.path: @@ -232,17 +234,24 @@ def frappy_list(service=None): session.log.info(' ') printTable(['command'], [['frappy_list(%r)' % s] for s in SERVICES], session.log.info) session.log.info(' ') - for cfgdir in bases: + + def dummy(*args, **kwds): + pass + + class Node: + description = '' + + def __call__(id, desc, *args, **kwds): + self.description = desc + + namespace = {k: dummy for k in ('Mod', 'Param', 'Command', 'Group')} + node = Node() + namespace['Node'] = node + for cfgdir, name in bases: table.append(['---\n', cfgdir]) - for cfgfile in glob(join(cfgdir, '*.cfg')): - parser = ConfigParser() - parser.read(cfgfile) - desc = '' - for s in parser.sections(): - if s == 'NODE' or s.startswith('node '): - desc = parser[s].get('description', '').split('\n')[0] - break - table.append([basename(cfgfile)[:-4], desc]) + for cfgfile in glob(join(cfgdir, '*_cfg.py')): + exec(cfgfile, namespace) + table.append([basename(cfgfile)[:-7], node.description]) printTable(['cfg file', 'description'], table, session.log.info)