[debian/*.py] remove trailing whitespaces
Ignore-this: f62e84c258c847013d307d12acdf489e darcs-hash:20090309212356-0445d-d8338d06f968f316fcd085446023123be87040f7.gz
This commit is contained in:
parent
cc31727b60
commit
eae0d21f83
18 changed files with 352 additions and 352 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" Gestion de lock
|
||||
""" Gestion de lock
|
||||
|
||||
Copyright (C) Frédéric Pauget
|
||||
Licence : GPLv2
|
||||
|
@ -51,7 +51,7 @@ def wait_lock(lock_name, lock_comment='', d=None, retry=0.2):
|
|||
return d
|
||||
|
||||
def make_lock(lock_name, lock_comment='',nowait=0, quiet=False) :
|
||||
""" Création d'un lock
|
||||
""" Création d'un lock
|
||||
si nowait=1 fait un sys.exit(254) quand un ancien lock actif est rencontré
|
||||
"""
|
||||
return
|
||||
|
@ -76,7 +76,7 @@ def make_lock(lock_name, lock_comment='',nowait=0, quiet=False) :
|
|||
raise AssertionError('In critical section')
|
||||
else:
|
||||
sys.stderr.write('\tpropriétaire : inconnu\n\tpid : inconnu\n\tdémarré depuis inconnu\n')
|
||||
sys.exit(254)
|
||||
sys.exit(254)
|
||||
else:
|
||||
# La procédure de lock est deja en cours d'execution, on essaie un peu plus tard
|
||||
time.sleep(0.5)
|
||||
|
@ -87,13 +87,13 @@ def make_lock(lock_name, lock_comment='',nowait=0, quiet=False) :
|
|||
|
||||
if os.path.isfile(lock_file) :
|
||||
### Lock existant
|
||||
|
||||
|
||||
# Lecture du lock
|
||||
fd = open(lock_file, "r")
|
||||
pid= fd.readline().strip()
|
||||
user = fd.readline().strip()
|
||||
fd.close()
|
||||
|
||||
|
||||
# Informations sur le processus lockant
|
||||
if os.system( "ps ax | grep -q '^%s '" % pid ) :
|
||||
# Le script lockant ne tourne plus
|
||||
|
@ -103,16 +103,16 @@ def make_lock(lock_name, lock_comment='',nowait=0, quiet=False) :
|
|||
sys.stderr.write('Lock : %s\n' % lock_file)
|
||||
l=getoutput("ps ax -o pid,etime | awk '($1 == %s)'" % pid)
|
||||
data = [ user , pid , l.strip() ]
|
||||
|
||||
|
||||
# Formatate de etime
|
||||
s = data[-1].split('-')
|
||||
if len(s)==2 :
|
||||
txt = '%s jour(s) ' % s[0]
|
||||
s=s[1]
|
||||
else :
|
||||
else :
|
||||
txt = ''
|
||||
s=s[0]
|
||||
|
||||
|
||||
s = s.split(':')
|
||||
if len(s) == 3 :
|
||||
txt = '%sh%smin%ss' % tuple(s)
|
||||
|
@ -140,7 +140,7 @@ def make_lock(lock_name, lock_comment='',nowait=0, quiet=False) :
|
|||
lockf(lock_fd_dl, LOCK_UN)
|
||||
lock_fd_dl.close()
|
||||
return make_lock(lock_name, lock_comment)
|
||||
|
||||
|
||||
### Prise du lock
|
||||
lock_fd = file(lock_file,"w")
|
||||
try:
|
||||
|
@ -153,7 +153,7 @@ def make_lock(lock_name, lock_comment='',nowait=0, quiet=False) :
|
|||
# On enleve le verrou système
|
||||
lockf(lock_fd_dl, LOCK_UN)
|
||||
lock_fd_dl.close()
|
||||
|
||||
|
||||
|
||||
def remove_lock( lock_name ) :
|
||||
""" Destruction du lock """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue