diff --git a/sat_frontends/jp/base.py b/sat_frontends/jp/base.py index e69f32d0..98149d23 100644 --- a/sat_frontends/jp/base.py +++ b/sat_frontends/jp/base.py @@ -84,7 +84,7 @@ def date_decoder(arg): return date_utils.date_parse_ext(arg, default_tz=date_utils.TZ_LOCAL) -class Jp(object): +class LiberviaCli: """ This class can be use to establish a connection with the bridge. Moreover, it should manage a main loop. @@ -669,10 +669,14 @@ class Jp(object): except QuitException: return - def run(self, args=None, namespace=None): + def _run(self, args=None, namespace=None): self.loop = JPLoop() self.loop.run(self, args, namespace) + @classmethod + def run(cls): + cls()._run() + def _read_stdin(self, stdin_fut): """Callback called by ainput to read stdin""" line = sys.stdin.readline() diff --git a/sat_frontends/jp/cmd_shell.py b/sat_frontends/jp/cmd_shell.py index dffa9b6d..f244a837 100644 --- a/sat_frontends/jp/cmd_shell.py +++ b/sat_frontends/jp/cmd_shell.py @@ -112,7 +112,7 @@ class Shell(base.CommandBase, cmd.Cmd): # XXX: below is a way to launch the command without creating a new process # may be used when a solution to the aforementioned issue is there # try: - # self.host.run(args) + # self.host._run(args) # except SystemExit as e: # ret_code = e.code # except Exception as e: diff --git a/sat_frontends/jp/jp b/sat_frontends/jp/jp deleted file mode 100755 index 9c6d40f6..00000000 --- a/sat_frontends/jp/jp +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# jp: a SAT command line tool -# Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org) - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. - -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -from sat_frontends.jp import base - -if __name__ == "__main__": - jp = base.Jp() - jp.run() diff --git a/sat_frontends/primitivus/primitivus b/sat_frontends/primitivus/base.py old mode 100755 new mode 100644 similarity index 99% rename from sat_frontends/primitivus/primitivus rename to sat_frontends/primitivus/base.py index 440ea363..36427a63 --- a/sat_frontends/primitivus/primitivus +++ b/sat_frontends/primitivus/base.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # Primitivus: a SAT frontend # Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org) @@ -295,6 +294,10 @@ class PrimitivusApp(QuickApp, InputHistory): event_loop = urwid.GLibEventLoop if 'dbus' in bridge_name else urwid.TwistedEventLoop self.loop = urwid.MainLoop(urwid.SolidFill(), C.PALETTE, event_loop=event_loop(), input_filter=self.inputFilter, unhandled_input=self.keyHandler) + @classmethod + def run(cls): + cls().start() + def onBridgeConnected(self): ##misc setup## @@ -854,5 +857,5 @@ class PrimitivusApp(QuickApp, InputHistory): else: log.warning(u"No ContactList widget found for profile {}".format(profile)) -primitivus = PrimitivusApp() -primitivus.start() +if __name__ == '__main__': + PrimitivusApp().start() diff --git a/setup.py b/setup.py index 8d8e60b2..5162b33e 100644 --- a/setup.py +++ b/setup.py @@ -84,9 +84,9 @@ def sat_dev_version(): setup( name=NAME, version=VERSION, - description="Salut à Toi multipurpose and multi frontend XMPP client", - long_description="Salut à Toi (SàT) is a XMPP client based on a daemon/frontend " - "architecture. Its multi frontend (desktop, web, console " + description="Libervia multipurpose and multi frontend XMPP client", + long_description="Libervia is a XMPP client based on a daemon/frontend " + "architecture. It's multi frontend (desktop, web, console " "interface, CLI, etc) and multipurpose (instant messaging, " "microblogging, games, file sharing, etc).", author="Association « Salut à Toi »", @@ -96,6 +96,7 @@ setup( "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Development Status :: 5 - Production/Stable", "Environment :: Console", "Framework :: Twisted", @@ -113,10 +114,20 @@ setup( ], entry_points={ "console_scripts": [ + # backend + alias + "libervia-backend = sat.core.launcher:Launcher.run", "sat = sat.core.launcher:Launcher.run", + + # CLI + aliases + "libervia-cli = sat_frontends.jp.base:LiberviaCli.run", + "li = sat_frontends.jp.base:LiberviaCli.run", + "jp = sat_frontends.jp.base:LiberviaCli.run", + + # TUI + alias + "libervia-tui = sat_frontends.primitivus.base:PrimitivusApp.run", + "primitivus = sat_frontends.primitivus.base:PrimitivusApp.run", ], }, - scripts=["sat_frontends/jp/jp", "sat_frontends/primitivus/primitivus"], zip_safe=False, setup_requires=["setuptools_scm"] if is_dev_version else [], use_scm_version=sat_dev_version if is_dev_version else False,