moulinette/bin/yunohost-api
Jerome Lebleu 9c9ccc1271 Try to improve time execution and continue refactoring
* Revert to classes centralization into actionsmap.py
* Try to optimize conditions and loops
* Revisit Package class and get directories from a file generated at build
* Early refactoring of i18n
* Move yunohost library into /lib
2014-03-11 00:57:28 +01:00

45 lines
968 B
Python
Executable file

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os.path
# Run from source
basedir = os.path.abspath(os.path.dirname(__file__) +'/../')
if os.path.isdir(basedir +'/src'):
sys.path.append(basedir +'/src')
from moulinette import init, api
## Callbacks for additional routes
def is_installed():
"""
Check whether YunoHost is installed or not
"""
installed = False
if os.path.isfile('/etc/yunohost/installed'):
installed = True
return { 'installed': installed }
## Main action
if __name__ == '__main__':
# Run from source
init(_from_source=True)
# Additional arguments
use_cache = True
if '--no-cache' in sys.argv:
use_cache = False
sys.argv.remove('--no-cache')
if '--debug' in sys.argv:
sys.argv.remove('--debug')
# TODO: Add log argument
# Rune the server
api(['yunohost'], 6787, {('GET', '/installed'): is_installed}, use_cache)
sys.exit(0)