Am 20.10.10 02:35, schrieb Federico G. Schwindt: > On Tue, Oct 19, 2010 at 08:46:38PM +0200, David Coppa wrote: >> On Tue, Oct 19, 2010 at 8:40 PM, Tasmanian Devil >> <[email protected]> wrote: >> >>> Ok, I tried to find out how to do this and how to make a proper >>> "all-in-one" patch. I have no idea if the changes I made are correct >>> Python, but the result seems to works fine for me so far. Please point >>> out any mistakes I made. Patch attached. >> >> it looks fine to me. > > looks good to me too. > for the md5 warning i'd prefer if we handle the pre-2.5 case as well since > it's easy to do so. i wouldn't bother with new ports, though. > > f.-
Corrected patch attached. Works fine for me on -current and 4.7, but also the normal port on 4.7 already expects at least Python 2.5, so I didn't test with Python 2.4. Tas.
Index: Makefile =================================================================== RCS file: /cvs/ports/sysutils/tentakel/Makefile,v retrieving revision 1.12 diff -u -r1.12 Makefile --- Makefile 19 Oct 2010 07:43:03 -0000 1.12 +++ Makefile 20 Oct 2010 11:38:10 -0000 @@ -3,7 +3,7 @@ COMMENT= distributed command execution DISTNAME= tentakel-357 -REVISION = 1 +REVISION = 2 CATEGORIES= sysutils MAINTAINER= Sebastian Stark <[email protected]> HOMEPAGE= http://tentakel.biskalar.de/ Index: patches/patch-py_lekatnet_config_py =================================================================== RCS file: patches/patch-py_lekatnet_config_py diff -N patches/patch-py_lekatnet_config_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-py_lekatnet_config_py 20 Oct 2010 11:38:10 -0000 @@ -0,0 +1,25 @@ +--- py/lekatnet/config.py.orig Sun Feb 8 13:16:38 2009 ++++ py/lekatnet/config.py Tue Oct 19 19:23:55 2010 +@@ -52,7 +52,7 @@ import pwd + import tempfile + import sys + import tpg +-import popen2 ++from subprocess import Popen, PIPE + + PARAMS = { 'ssh_path': "/usr/bin/ssh", + 'rsh_path': "/usr/bin/rsh", +@@ -265,10 +265,9 @@ class ConfigBase(dict): + for dhost in dhosts: + if not os.path.isabs(dhost): + dhost = os.path.join(_user_dir, dhost) +- p = popen2.Popen3(dhost, capturestderr=True) +- p.tochild.close() +- err = p.childerr.read() +- out = p.fromchild.read() ++ p = Popen(dhost, stderr=PIPE, stdin=PIPE, stdout=PIPE, close_fds=True, shell=True) ++ err = p.stderr.read() ++ out = p.stdout.read() + status = p.wait() >> 8 + if err: + for line in err.split('\n'): Index: patches/patch-py_lekatnet_plugins_rsh_py =================================================================== RCS file: patches/patch-py_lekatnet_plugins_rsh_py diff -N patches/patch-py_lekatnet_plugins_rsh_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-py_lekatnet_plugins_rsh_py 20 Oct 2010 11:38:10 -0000 @@ -0,0 +1,14 @@ +--- py/lekatnet/plugins/rsh.py.orig Sun Feb 8 13:16:38 2009 ++++ py/lekatnet/plugins/rsh.py Tue Oct 19 19:23:55 2010 +@@ -26,7 +26,10 @@ from lekatnet.remote import registerRemoteCommandPlugi + from lekatnet.remote import RemoteCommand + import time + import random +-import md5 ++try: ++ from hashlib import md5 ++except ImportError: ++ from md5 import md5 + + class RSHRemoteCommand(RemoteCommand): + "RSH remote execution class" Index: patches/patch-py_lekatnet_remote_py =================================================================== RCS file: patches/patch-py_lekatnet_remote_py diff -N patches/patch-py_lekatnet_remote_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-py_lekatnet_remote_py 20 Oct 2010 11:38:10 -0000 @@ -0,0 +1,29 @@ +--- py/lekatnet/remote.py.orig Sun Feb 8 13:16:38 2009 ++++ py/lekatnet/remote.py Tue Oct 19 19:23:55 2010 +@@ -45,7 +45,7 @@ import tpg + import time + import os + import config +-from popen2 import Popen3 ++from subprocess import Popen, PIPE + + + class FormatString(tpg.Parser): +@@ -138,13 +138,10 @@ class RemoteCommand(threading.Thread): + # + def getstatusoutput(self, cmd): + """Return (status, output) of executing cmd in a shell.""" +- p = Popen3(cmd, capturestderr=True) +- p.tochild.write(self.stdin) +- p.tochild.close() +- err = p.childerr.read() +- p.childerr.close() +- text = p.fromchild.read() +- p.fromchild.close() ++ p = Popen(cmd, stderr=PIPE, stdin=PIPE, stdout=PIPE, close_fds=True, shell=True) ++ p.stdin.write(self.stdin) ++ err = p.stderr.read() ++ text = p.stdout.read() + sts = p.wait() + if sts is None: sts = 0 + if text[-1:] == '\n': text = text[:-1]
