Use setuptools' automatic script creation

This commit is contained in:
André Apitzsch 2018-01-13 22:07:25 +01:00
parent aa6e9e7084
commit 7943120b25
8 changed files with 40 additions and 118 deletions

View File

@ -437,6 +437,14 @@ class GajimApplication(Gtk.Application):
self.lookup_action(account + action_name).set_enabled(True)
if __name__ == '__main__':
def main():
if sys.platform != 'win32':
if os.geteuid() == 0:
sys.exit("You must not launch gajim as root, it is insecure.")
appli = GajimApplication()
appli.run(sys.argv)
if __name__ == '__main__':
main()

View File

@ -27,6 +27,7 @@
# gajim-remote help will show you the D-BUS API of Gajim
import os
import sys
import locale
import urllib
@ -500,5 +501,13 @@ class GajimRemote:
raise exceptions.ServiceNotAvailable
return None
if __name__ == '__main__':
def main():
if os.geteuid() == 0:
sys.exit("You must not launch gajim as root, it is insecure.")
GajimRemote()
if __name__ == '__main__':
main()

View File

@ -30,7 +30,6 @@
import os
import sys
import signal
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
@ -668,7 +667,15 @@ class HistoryManager:
path = self.logs_liststore.get_path(iter_)
self.logs_listview.scroll_to_cell(path)
if __name__ == '__main__':
signal.signal(signal.SIGINT, signal.SIG_DFL) # ^C exits the application
def main():
if sys.platform != 'win32':
if os.geteuid() == 0:
sys.exit("You must not launch gajim as root, it is insecure.")
HistoryManager()
Gtk.main()
if __name__ == '__main__':
main()

View File

@ -1,12 +1,4 @@
#!/usr/bin/env python3
import os
import sys
if sys.platform != 'win32':
if os.geteuid() == 0:
sys.exit("You must not launch gajim as root, it is insecure.")
import gajim.gajim as g
g.GajimApplication().run(sys.argv)
from gajim import gajim
gajim.main()

View File

@ -1,32 +0,0 @@
#!/usr/bin/env python3
##
## Copyright (C) 2005 Yann Le Boulanger <asterix AT lagaule.org>
## Copyright (C) 2006 Dimitur Kirov <dkirov AT gmail.com>
## Stefan Bethge <stefan AT lanpartei.de>
## Copyright (C) 2008 Jonathan Schleifer <js-gajim AT webkeks.org>
##
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; version 3 only.
##
## Gajim 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
import os
import sys
if sys.platform != 'win32':
if os.geteuid() == 0:
sys.exit("You must not launch gajim as root, it is insecure.")
import gajim.gajim as g
g.GajimApplication().run(sys.argv)

View File

@ -1,36 +0,0 @@
#!/usr/bin/env python3
##
## Copyright (C) 2005 Yann Le Boulanger <asterix AT lagaule.org>
## Copyright (C) 2006 Dimitur Kirov <dkirov AT gmail.com>
## Stefan Bethge <stefan AT lanpartei.de>
## Copyright (C) 2008 Jonathan Schleifer <js-gajim AT webkeks.org>
##
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; version 3 only.
##
## Gajim 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
import os
import sys
if sys.platform != 'win32':
if os.geteuid() == 0:
sys.exit("You must not launch gajim as root, it is insecure.")
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import gajim.history_manager as g
g.HistoryManager()
Gtk.main()

View File

@ -1,31 +0,0 @@
#!/usr/bin/env python3
##
## Copyright (C) 2005 Yann Le Boulanger <asterix AT lagaule.org>
## Copyright (C) 2006 Dimitur Kirov <dkirov AT gmail.com>
## Stefan Bethge <stefan AT lanpartei.de>
## Copyright (C) 2008 Jonathan Schleifer <js-gajim AT webkeks.org>
##
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; version 3 only.
##
## Gajim 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
import os
import sys
if os.geteuid() == 0:
sys.exit("You must not launch gajim as root, it is insecure.")
import gajim.gajim_remote as g
g.GajimRemote()

View File

@ -261,10 +261,15 @@ setup(
'test_nogui': test_nogui,
'update_po': update_po,
},
scripts=[
'scripts/gajim',
'scripts/gajim-history-manager',
'scripts/gajim-remote'],
entry_points={
'console_scripts': [
'gajim-remote = gajim.gajim_remote:main',
],
'gui_scripts': [
'gajim = gajim.gajim:main',
'gajim-history-manager = gajim.history_manager:main',
]
},
packages=find_packages(exclude=["gajim.dev", "test*"]),
package_data={'gajim': package_data},
data_files=data_files,