def check_package(path, name): full_path = os.path.join(path, name) if not fsutils.isdir(full_path) or name[0] == '.': return False py_file = os.path.join(full_path, '__init__.py') pyc_file = os.path.join(full_path, '__init__.pyc') return fsutils.exists(py_file) or fsutils.exists(pyc_file)
def get_langs(): if not LANGS: LANGS.append(_('system')) path = os.path.join(config.resource_dir, 'locales') langs = ['en', ] if fsutils.exists(path): langs += [item for item in os.listdir(fsutils.get_sys_path(path)) if fsutils.isdir(os.path.join(path, item))] langs.sort() for item in langs: LANGS.append(item)