add conditional Interface import + app factory

This commit is contained in:
axolotle 2023-01-07 13:54:33 +01:00
parent 39e7f0d8a5
commit a318e06e8d
2 changed files with 16 additions and 0 deletions

10
src/__init_.py Normal file
View file

@ -0,0 +1,10 @@
from yunohost.interface import Interface
from yunohost.user import app as user_app
def create_interface():
app = Interface(root=True)
app.add(user_app)
return app.instance

View file

@ -0,0 +1,6 @@
import os
if os.environ.get("INTERFACE", "cli") == "cli":
from yunohost.interface.cli import Interface # noqa
else:
from yunohost.interface.api import Interface # noqa