more portable way to display applications list (but the module name isn't necessarily the same than script)
This commit is contained in:
parent
959de0b1bf
commit
a89141632f
1 changed files with 11 additions and 3 deletions
|
|
@ -19,6 +19,7 @@ import ConfigParser
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import re
|
||||||
|
|
||||||
import weboob
|
import weboob
|
||||||
from weboob.tools.application import ConsoleApplication
|
from weboob.tools.application import ConsoleApplication
|
||||||
|
|
@ -61,9 +62,16 @@ class WeboobCfg(ConsoleApplication):
|
||||||
|
|
||||||
@ConsoleApplication.command('List applications')
|
@ConsoleApplication.command('List applications')
|
||||||
def command_applications(self, *caps):
|
def command_applications(self, *caps):
|
||||||
applications_path = os.path.abspath(os.path.join(os.path.dirname(weboob.__file__), '..', 'scripts'))
|
import weboob.frontends
|
||||||
assert os.path.exists(applications_path)
|
path = weboob.frontends.__path__[0]
|
||||||
print ' '.join(f for f in os.listdir(applications_path) if not f.startswith('.'))
|
frontends = []
|
||||||
|
regexp = re.compile('^%s/([\w\d_]+)$' % path)
|
||||||
|
for root, dirs, files in os.walk(path):
|
||||||
|
m = regexp.match(root)
|
||||||
|
if m and '__init__.py' in files:
|
||||||
|
frontends.append(m.group(1))
|
||||||
|
|
||||||
|
print ' '.join(frontends)
|
||||||
|
|
||||||
@ConsoleApplication.command('Display a module')
|
@ConsoleApplication.command('Display a module')
|
||||||
def command_modinfo(self, name):
|
def command_modinfo(self, name):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue