Detabification massive.

darcs-hash:20051018083823-d1718-09c2df38cfb707d3c3679188b9b9a812009f4f7c.gz
This commit is contained in:
bernat 2005-10-18 10:38:23 +02:00
parent 3c54fb2904
commit 37b21339a6
40 changed files with 1473 additions and 1473 deletions

View file

@ -23,75 +23,75 @@ import nntplib,string,os,StringIO
def LFsplit(s):
res=""
while len(s)>80 :
pos=string.find(s,' ',65,80)
if pos < 0 :
res=res+s[0:75]+'\n'
s=s[75:len(s)+1]
else :
res=res+s[0:pos]+'\n'
s=s[pos+1:len(s)+1]
pos=string.find(s,' ',65,80)
if pos < 0 :
res=res+s[0:75]+'\n'
s=s[75:len(s)+1]
else :
res=res+s[0:pos]+'\n'
s=s[pos+1:len(s)+1]
if len(s)>0:
res=res+s
res=res+s
return res
for uid in os.listdir('/var/local/cvsweb/checkins/'):
try:
so = []
so = []
fi = open('/var/local/cvsweb/checkins/'+uid,'r')
so.append("From: CVS admin <root@crans.org>\n" + \
("Subject: CVS Commit par %s\n" % uid)+ \
"Organization: Crans Internet Site\n" + \
"Newsgroups: crans.cvs-checkins\n" + \
"Reply-To: Nounous <nounou@crans.org>\n" + \
"Followup-To: crans.informatique\n" )
so.append("From: CVS admin <root@crans.org>\n" + \
("Subject: CVS Commit par %s\n" % uid)+ \
"Organization: Crans Internet Site\n" + \
"Newsgroups: crans.cvs-checkins\n" + \
"Reply-To: Nounous <nounou@crans.org>\n" + \
"Followup-To: crans.informatique\n" )
so.append("MIME-Version: 1.0\n" + \
"Content-Type: text/plain\n")
so.append("\n")
envoie = 0
links_base="http://www.crans.org/cgi-bin/cvsweb"
while 1:
s = fi.readline()
if not s: break
envoie = 1
links=['Liens vers les diffs sur cvsweb :\n']
diffok = 0
# On essaye de créer les liens vers cvsweb automatiquement.
try:
if s[0:3]=="web":
link=string.split(s)
for file in link[1:]:
file=string.split(file,",")
if not string.split(file[0],".")[-1] in ['jpg','jpeg','gif','png']:
links.append("%s/%s/%s.diff?r1=%s&r2=%s\n" % (links_base,link[0],file[0],file[1],file[2]))
diffok = 1
# S'il y a au moins un diff affichable, on donne le lien.
if diffok:
links.append('\n')
s=string.join(links,'')
else:
s=LFsplit(s)
so.append(s)
except:
so.append(s)
# Avec une signature c'est plus propre.
so.append("\n" + \
"-- \n" + \
"Notification automatique des CVS commits sur le site du CR@NS.\n"+ \
"Voir http://www.crans.org/cgi-bin/cvsweb/web/ pour accéder aux archives CVS complètes.")
so.append("MIME-Version: 1.0\n" + \
"Content-Type: text/plain\n")
so.append("\n")
envoie = 0
links_base="http://www.crans.org/cgi-bin/cvsweb"
while 1:
s = fi.readline()
if not s: break
envoie = 1
links=['Liens vers les diffs sur cvsweb :\n']
diffok = 0
# On essaye de créer les liens vers cvsweb automatiquement.
try:
if s[0:3]=="web":
link=string.split(s)
for file in link[1:]:
file=string.split(file,",")
if not string.split(file[0],".")[-1] in ['jpg','jpeg','gif','png']:
links.append("%s/%s/%s.diff?r1=%s&r2=%s\n" % (links_base,link[0],file[0],file[1],file[2]))
diffok = 1
# S'il y a au moins un diff affichable, on donne le lien.
if diffok:
links.append('\n')
s=string.join(links,'')
else:
s=LFsplit(s)
so.append(s)
except:
so.append(s)
# Avec une signature c'est plus propre.
so.append("\n" + \
"-- \n" + \
"Notification automatique des CVS commits sur le site du CR@NS.\n"+ \
"Voir http://www.crans.org/cgi-bin/cvsweb/web/ pour accéder aux archives CVS complètes.")
# maintenant, on envoie :
# maintenant, on envoie :
if envoie:
sso = string.join(so,'')
fso = StringIO.StringIO(sso)
nntplib.NNTP('news.crans.org').post(fso)
#print sso
fi.close()
os.unlink('/var/local/cvsweb/checkins/'+uid)
if envoie:
sso = string.join(so,'')
fso = StringIO.StringIO(sso)
nntplib.NNTP('news.crans.org').post(fso)
#print sso
fi.close()
os.unlink('/var/local/cvsweb/checkins/'+uid)
except:
raise
raise