some error fixed, thanks pylint.
This commit is contained in:
parent
b20199a423
commit
93fe011100
|
@ -7,5 +7,5 @@ import sys
|
||||||
if os.getcwd().endswith('dev'):
|
if os.getcwd().endswith('dev'):
|
||||||
os.chdir('../../src/') # we were in scripts/dev
|
os.chdir('../../src/') # we were in scripts/dev
|
||||||
|
|
||||||
os.system("pylint --indent-string='\t' --additional-builtins='_' --disable-msg=C0111,C0103,C0111,C0112 --disable-checker=design " + "".join(sys.argv[1:]))
|
os.system("pylint --additional-builtins='_' --disable-msg=C0111,C0103,C0111,C0112 --disable-checker=design " + "".join(sys.argv[1:]))
|
||||||
|
|
||||||
|
|
37
src/gajim.py
37
src/gajim.py
|
@ -83,7 +83,9 @@ def parseOpts():
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
for o, a in opts:
|
for o, a in opts:
|
||||||
if o in ('-h', '--help'):
|
if o in ('-h', '--help'):
|
||||||
print 'gajim [--help] [--quiet] [--verbose] [--loglevel subsystem=level[,subsystem=level[...]]] [--profile name] [--config-path]'
|
print 'gajim [--help] [--quiet] [--verbose] ' + \
|
||||||
|
'[--loglevel subsystem=level[,subsystem=level[...]]] ' + \
|
||||||
|
'[--profile name] [--config-path]'
|
||||||
sys.exit()
|
sys.exit()
|
||||||
elif o in ('-q', '--quiet'):
|
elif o in ('-q', '--quiet'):
|
||||||
logging_helpers.set_quiet()
|
logging_helpers.set_quiet()
|
||||||
|
@ -114,8 +116,8 @@ if os.name == 'nt':
|
||||||
_file = None
|
_file = None
|
||||||
_error = None
|
_error = None
|
||||||
def write(self, text):
|
def write(self, text):
|
||||||
fname=os.path.join(common.configpaths.gajimpaths.cache_root,
|
fname = os.path.join(common.configpaths.gajimpaths.cache_root,
|
||||||
os.path.split(sys.executable)[1]+'.log')
|
os.path.split(sys.executable)[1]+'.log')
|
||||||
if self._file is None and self._error is None:
|
if self._file is None and self._error is None:
|
||||||
try:
|
try:
|
||||||
self._file = open(fname, 'a')
|
self._file = open(fname, 'a')
|
||||||
|
@ -152,12 +154,13 @@ try:
|
||||||
from common import gajim
|
from common import gajim
|
||||||
except exceptions.DatabaseMalformed:
|
except exceptions.DatabaseMalformed:
|
||||||
pritext = _('Database Error')
|
pritext = _('Database Error')
|
||||||
sectext = _('The database file (%s) cannot be read. Try to repair it (see http://trac.gajim.org/wiki/DatabaseBackup) or remove it (all history will be lost).') % common.logger.LOG_DB_PATH
|
sectext = _('The database file (%s) cannot be read. Try to repair it (see '
|
||||||
|
'http://trac.gajim.org/wiki/DatabaseBackup) or remove it (all history '
|
||||||
|
'will be lost).') % common.logger.LOG_DB_PATH
|
||||||
else:
|
else:
|
||||||
from common import dbus_support
|
from common import dbus_support
|
||||||
if dbus_support.supported:
|
if dbus_support.supported:
|
||||||
from music_track_listener import MusicTrackListener
|
from music_track_listener import MusicTrackListener
|
||||||
import dbus
|
|
||||||
|
|
||||||
from ctypes import CDLL
|
from ctypes import CDLL
|
||||||
from ctypes.util import find_library
|
from ctypes.util import find_library
|
||||||
|
@ -167,8 +170,8 @@ else:
|
||||||
if sysname in ('Linux', 'FreeBSD', 'OpenBSD', 'NetBSD'):
|
if sysname in ('Linux', 'FreeBSD', 'OpenBSD', 'NetBSD'):
|
||||||
libc = CDLL(find_library('c'))
|
libc = CDLL(find_library('c'))
|
||||||
|
|
||||||
# The constant defined in <linux/prctl.h> which is used to set the name of
|
# The constant defined in <linux/prctl.h> which is used to set the name
|
||||||
# the process.
|
# of the process.
|
||||||
PR_SET_NAME = 15
|
PR_SET_NAME = 15
|
||||||
|
|
||||||
if sysname == 'Linux':
|
if sysname == 'Linux':
|
||||||
|
@ -183,11 +186,7 @@ else:
|
||||||
pritext = _('Gajim needs GTK 2.16 or above')
|
pritext = _('Gajim needs GTK 2.16 or above')
|
||||||
sectext = _('Gajim needs GTK 2.16 or above to run. Quiting...')
|
sectext = _('Gajim needs GTK 2.16 or above to run. Quiting...')
|
||||||
|
|
||||||
try:
|
from common import check_paths
|
||||||
from common import check_paths
|
|
||||||
except exceptions.PysqliteNotAvailable, e:
|
|
||||||
pritext = _('Gajim needs PySQLite2 to run')
|
|
||||||
sectext = str(e)
|
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
try:
|
try:
|
||||||
|
@ -195,7 +194,9 @@ else:
|
||||||
import win32api # do NOT remove. we req this module
|
import win32api # do NOT remove. we req this module
|
||||||
except Exception:
|
except Exception:
|
||||||
pritext = _('Gajim needs pywin32 to run')
|
pritext = _('Gajim needs pywin32 to run')
|
||||||
sectext = _('Please make sure that Pywin32 is installed on your system. You can get it at %s') % 'http://sourceforge.net/project/showfiles.php?group_id=78018'
|
sectext = _('Please make sure that Pywin32 is installed on your '
|
||||||
|
'system. You can get it at %s') % \
|
||||||
|
'http://sourceforge.net/project/showfiles.php?group_id=78018'
|
||||||
|
|
||||||
if pritext:
|
if pritext:
|
||||||
dlg = gtk.MessageDialog(None,
|
dlg = gtk.MessageDialog(None,
|
||||||
|
@ -248,7 +249,8 @@ def pid_alive():
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
try:
|
try:
|
||||||
from ctypes import (windll, c_ulong, c_int, Structure, c_char, POINTER, pointer, )
|
from ctypes import (windll, c_ulong, c_int, Structure, c_char)
|
||||||
|
from ctypes import (POINTER, pointer, )
|
||||||
except Exception:
|
except Exception:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -325,7 +327,6 @@ if pid_alive():
|
||||||
# run anyway, delete pid and useless global vars
|
# run anyway, delete pid and useless global vars
|
||||||
if os.path.exists(pid_filename):
|
if os.path.exists(pid_filename):
|
||||||
os.remove(pid_filename)
|
os.remove(pid_filename)
|
||||||
del path_to_file
|
|
||||||
del pix
|
del pix
|
||||||
del pritext
|
del pritext
|
||||||
del sectext
|
del sectext
|
||||||
|
@ -389,9 +390,9 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
if path_to_gajim_script:
|
if path_to_gajim_script:
|
||||||
argv = [path_to_gajim_script]
|
argv = [path_to_gajim_script]
|
||||||
# FIXME: remove this typeerror catch when gnome python is old and
|
# FIXME: remove this typeerror catch when gnome python is old
|
||||||
# not bad patched by distro men [2.12.0 + should not need all that
|
# and not bad patched by distro men [2.12.0 + should not need
|
||||||
# NORMALLY]
|
# all that NORMALLY]
|
||||||
try:
|
try:
|
||||||
cli.set_restart_command(argv)
|
cli.set_restart_command(argv)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
Loading…
Reference in New Issue