fix frappy_list
first attempt
This commit is contained in:
29
commands.py
29
commands.py
@ -32,6 +32,8 @@ from nicos.commands import helparglist, usercommand
|
|||||||
from nicos.commands.basic import AddSetup, CreateAllDevices, CreateDevice
|
from nicos.commands.basic import AddSetup, CreateAllDevices, CreateDevice
|
||||||
from nicos.devices.secop.devices import get_attaching_devices
|
from nicos.devices.secop.devices import get_attaching_devices
|
||||||
from nicos_sinq.frappy_sinq.devices import applyAliasConfig
|
from nicos_sinq.frappy_sinq.devices import applyAliasConfig
|
||||||
|
from servicemanager import FrappyManager
|
||||||
|
|
||||||
|
|
||||||
home = expanduser('~')
|
home = expanduser('~')
|
||||||
if home not in sys.path:
|
if home not in sys.path:
|
||||||
@ -232,17 +234,24 @@ def frappy_list(service=None):
|
|||||||
session.log.info(' ')
|
session.log.info(' ')
|
||||||
printTable(['command'], [['frappy_list(%r)' % s] for s in SERVICES], session.log.info)
|
printTable(['command'], [['frappy_list(%r)' % s] for s in SERVICES], session.log.info)
|
||||||
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])
|
table.append(['---\n', cfgdir])
|
||||||
for cfgfile in glob(join(cfgdir, '*.cfg')):
|
for cfgfile in glob(join(cfgdir, '*_cfg.py')):
|
||||||
parser = ConfigParser()
|
exec(cfgfile, namespace)
|
||||||
parser.read(cfgfile)
|
table.append([basename(cfgfile)[:-7], node.description])
|
||||||
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])
|
|
||||||
printTable(['cfg file', 'description'], table, session.log.info)
|
printTable(['cfg file', 'description'], table, session.log.info)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user