if len(sys.argv) > 1 and not '--help' in sys.argv and \ not '--help-commands' in sys.argv: def cxml_finder(result, dirname, names): for name in names: if name.endswith('.cxml'): result.append(os.path.join(dirname, name)) return result cxml_files = [] os.path.walk('./src', cxml_finder, cxml_files) if not os.path.isfile('build/config.cxml') or \ os.stat('build/config.cxml')[stat.ST_MTIME] < \ max(*[os.stat(x)[stat.ST_MTIME] for x in cxml_files ]): if not os.path.isdir('build'): os.mkdir('build') xmlconfig('build/config.cxml', cxml_files, 'freevo2') data_files.append(('share/freevo2/config', [ 'build/config.cxml' ])) def package_finder(result, dirname, names): """ os.path.walk helper for 'src' """ for name in names: if os.path.splitext(name)[1] == '.py': import_name = dirname.replace('/','.').replace('..src', 'freevo2') result[import_name] = dirname return result return result package_dir = {}
not '--help-commands' in sys.argv: def cxml_finder(result, dirname, names): for name in names: if name.endswith('.cxml'): result.append(os.path.join(dirname, name)) return result cxml_files = [] os.path.walk('./src', cxml_finder, cxml_files) if not os.path.isfile('build/config.cxml') or \ os.stat('build/config.cxml')[stat.ST_MTIME] < \ max(*[os.stat(x)[stat.ST_MTIME] for x in cxml_files ]): if not os.path.isdir('build'): os.mkdir('build') xmlconfig('build/config.cxml', cxml_files, 'freevo2') data_files.append(('share/freevo2/config', ['build/config.cxml'])) def package_finder(result, dirname, names): """ os.path.walk helper for 'src' """ for name in names: if os.path.splitext(name)[1] == '.py': import_name = dirname.replace('/', '.').replace('..src', 'freevo2') result[import_name] = dirname return result return result
from plugin import * # directory variables FREEVO_INSTALL_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), '../../../../..')) FREEVO_SHARE_DIR = os.path.abspath(os.path.join(FREEVO_INSTALL_DIR, 'share/freevo2')) FREEVO_DATA_DIR = '/var/lib/freevo' if os.getuid(): FREEVO_DATA_DIR = os.path.expanduser('~/.freevo/data') if not os.path.isdir(FREEVO_DATA_DIR): os.makedirs(FREEVO_DATA_DIR) # generate config pycfgfile = os.path.join(FREEVO_DATA_DIR, 'freevo_config.py') cfgdir = os.path.join(FREEVO_SHARE_DIR, 'config') cfgsource = [ os.path.join(cfgdir, f) for f in os.listdir(cfgdir) if f.endswith('.cxml') ] xmlconfig(pycfgfile, cfgsource, 'freevo.ui') # load config structure. This will add 'config', 'plugins' and 'events' execfile(pycfgfile) # create empty signals dict signals = {} # add events defined in xml config to event.py. for e in events: setattr(event, e, event.Event(e)) # activate plugins from config def load_plugins(module): for plugin in plugins: group = config