Fix predigest command

This commit is contained in:
Martin Blapp 2008-11-04 12:14:23 +00:00
parent 90e0f8506a
commit 3a49c883cf
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=222377
2 changed files with 26 additions and 21 deletions

View file

@ -8,7 +8,7 @@
PORTNAME= pyzor
PORTVERSION= 0.4.0
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= mail python
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}

View file

@ -1,5 +1,5 @@
--- lib/pyzor/client.py Sun Sep 8 22:37:15 2002
+++ lib/pyzor/client.py Wed Apr 13 17:08:42 2005
--- lib/pyzor/client.py.orig Sun Sep 8 22:37:15 2002
+++ lib/pyzor/client.py Mon Nov 3 13:22:58 2008
@@ -8,6 +8,7 @@
import getopt
import tempfile
@ -8,7 +8,7 @@
import sha
import pyzor
@@ -58,11 +57,6 @@
@@ -58,11 +59,6 @@
self.send(msg, address)
return self.read_response(msg.get_thread())
@ -20,7 +20,7 @@
def build_socket(self):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@@ -132,39 +126,50 @@
@@ -132,39 +128,50 @@
def run(self):
debug = 0
@ -83,7 +83,7 @@
if not os.path.exists(homedir):
os.mkdir(homedir)
@@ -197,10 +202,13 @@
@@ -197,10 +204,13 @@
def usage(self, s=None):
if s is not None:
sys.stderr.write("%s\n" % s)
@ -99,7 +99,7 @@
"""
% sys.argv[0])
sys.exit(2)
@@ -208,9 +216,9 @@
@@ -208,9 +218,9 @@
def ping(self, args):
@ -112,7 +112,7 @@
self.usage("%s does not take any non-option arguments" % args[0])
runner = ClientRunner(self.client.ping)
@@ -221,30 +229,23 @@
@@ -221,30 +231,23 @@
return runner.all_ok
@ -127,14 +127,14 @@
self.usage("%s does not take any non-option arguments" % args[0])
- runner = ClientRunner(self.client.shutdown)
+ do_mbox = 'msg'
-
- for arg in args2:
- server = Address.from_str(arg)
- runner.run(server, (server,))
-
- return runner.all_ok
-
+ do_mbox = 'msg'
-
- def info(self, args):
- getopt.getopt(args[1:], '')
@ -154,7 +154,7 @@
for server in self.servers:
response = runner.run(server, (digest, server))
@@ -252,34 +253,45 @@
@@ -252,34 +255,45 @@
def check(self, args):
@ -211,7 +211,7 @@
if not self.send_digest(digest, self.digest_spec,
self.client.report):
all_ok = False
@@ -302,20 +314,22 @@
@@ -302,20 +316,22 @@
def whitelist(self, args):
@ -240,7 +240,7 @@
if not self.send_digest(digest, self.digest_spec,
self.client.whitelist):
all_ok = False
@@ -324,28 +338,29 @@
@@ -324,32 +340,34 @@
def digest(self, args):
@ -279,8 +279,14 @@
+ except getopt.GetoptError:
self.usage("%s does not take any non-option arguments" % args[0])
+ do_mbox = 'msg'
def loop():
@@ -358,9 +373,9 @@
- for digest in FileDigester(sys.stdin, self.digest_spec):
+ for digest in get_input_handler(sys.stdin, self.digest_spec, do_mbox):
pass
modglobal_apply(globals(), {'DataDigester': PrintingDataDigester},
@@ -358,9 +376,9 @@
return True
def genkey(self, args):
@ -293,7 +299,7 @@
self.usage("%s does not take any non-option arguments" % args[0])
import getpass
@@ -414,7 +429,6 @@
@@ -414,7 +432,6 @@
'report': report,
'ping' : ping,
'genkey': genkey,
@ -301,7 +307,7 @@
'info': info,
'whitelist': whitelist,
'digest': digest,
@@ -608,31 +622,37 @@
@@ -608,30 +625,36 @@
@ -340,7 +346,7 @@
+ return JustDigestsIterator(fp)
+
+ raise ValueError, "unknown input style"
+
+class JustDigestsIterator(BasicIterator):
+ __slots__ = ['fp']
@ -353,11 +359,10 @@
+ if not l:
+ raise StopIteration
+ return l.rstrip()
+
class MailboxDigester(BasicIterator):
__slots__ = ['mbox', 'digest_spec', 'seekable']
@@ -645,7 +665,12 @@
@@ -645,7 +668,12 @@
self.seekable = seekable
def next(self):