Hi Seth (and ML), If you commit this, I think you will break again the minion for python 2.3, alas, the python 2.3 does not support syntax for decorators, so, no "@" are allowed. Here are two patches related to the fskcing python2.3 compatibility : Copyfile : rewrite without decorator Client (overloard part) : something I already told on ML, subprocess is not available on 2.3, so, we have to use the module given with func (but, it's someting for the overlord part, and the subprocess module is in the client part). Tell me if this is bad, because no body reacted the first time. (And maybe you think it's a bad thing, but, I don't know) Thank for the job ! Have a nice week, Nicolas Di Pietro -----Original Message----- From: func-list-bounces@xxxxxxxxxx [mailto:func-list-bounces@xxxxxxxxxx] On Behalf Of Seth Vidal Sent: Friday, April 23, 2010 5:04 PM To: func-list@xxxxxxxxxx Subject: func/minion func/minion/modules/copyfile.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) New commits: commit 40457674d0e8787d61947ccb0d51406ce8ecbcff Author: Seth Vidal <skvidal@xxxxxxxxxxxxxxxxx> Date: Fri Apr 23 11:04:59 2010 -0400 cleanup the import sha's from func copyfile so we don't emit a deprecation notice on python 2.5 and up diff --git a/func/minion/modules/copyfile.py b/func/minion/modules/copyfile.py index 8ae3351..e9411ab 100644 --- a/func/minion/modules/copyfile.py +++ b/func/minion/modules/copyfile.py @@ -8,8 +8,19 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +try: + import hashlib +except ImportError: + # Python-2.4.z ... gah! (or even 2.3!) + import sha + class hashlib: + @staticmethod + def new(algo): + if algo == 'sha1': + return sha.new() + raise ValueError, "Bad checksum type" + -import sha import os import time import shutil @@ -24,14 +35,14 @@ class CopyFile(func_module.FuncModule): description = "Allows for smart copying of a file." def _checksum_blob(self, blob): - thissum = sha.new() + thissum = hashlib.new('sha1') thissum.update(blob) return thissum.hexdigest() def checksum(self, thing): CHUNK=2**16 - thissum = sha.new() + thissum = hashlib.new('sha1') if os.path.exists(thing): fo = open(thing, 'r', CHUNK) chunk = fo.read _______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list
<<attachment: client.patch.zip>>
<<attachment: copyfile.patch.zip>>
_______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list