cubicweb/cwctl.py
changeset 12549 e2db422752b4
parent 12526 b78e3472a7d6
child 12567 26744ad37953
equal deleted inserted replaced
12548:6eec3213bec9 12549:e2db422752b4
    23 # *ctl module should limit the number of import to be imported as quickly as
    23 # *ctl module should limit the number of import to be imported as quickly as
    24 # possible (for cubicweb-ctl reactivity, necessary for instance for usable bash
    24 # possible (for cubicweb-ctl reactivity, necessary for instance for usable bash
    25 # completion). So import locally in command helpers.
    25 # completion). So import locally in command helpers.
    26 import sys
    26 import sys
    27 from warnings import filterwarnings
    27 from warnings import filterwarnings
    28 from os import listdir, system, pathsep
    28 from os import listdir, system
    29 from os.path import exists, join, isdir
    29 from os.path import exists, join, isdir
    30 
    30 
    31 try:
    31 try:
    32     from os import kill, getpgid
    32     from os import kill, getpgid
    33 except ImportError:
    33 except ImportError:
   228             print()
   228             print()
   229 
   229 
   230         if mode in ('all', 'cubes'):
   230         if mode in ('all', 'cubes'):
   231             cfgpb = ConfigurationProblem(cwcfg)
   231             cfgpb = ConfigurationProblem(cwcfg)
   232             try:
   232             try:
   233                 cubesdir = pathsep.join(cwcfg.cubes_search_path())
       
   234                 cube_names = available_cube_names(cwcfg)
   233                 cube_names = available_cube_names(cwcfg)
   235                 namesize = max(len(x) for x in cube_names)
   234                 namesize = max(len(x) for x in cube_names)
   236             except ConfigurationError as ex:
   235             except ConfigurationError as ex:
   237                 print('No cubes available:', ex)
   236                 print('No cubes available:', ex)
   238             except ValueError:
   237             except ValueError:
   239                 print('No cubes available in %s' % cubesdir)
   238                 print('No cubes available')
   240             else:
   239             else:
   241                 print('Available cubes (%s):' % cubesdir)
   240                 print('Available cubes:')
   242                 for cube in cube_names:
   241                 for cube in cube_names:
   243                     try:
   242                     try:
   244                         tinfo = cwcfg.cube_pkginfo(cube)
   243                         tinfo = cwcfg.cube_pkginfo(cube)
   245                         tversion = tinfo.version
   244                         tversion = tinfo.version
   246                         cfgpb.add_cube(cube, tversion)
   245                         cfgpb.add_cube(cube, tversion)