From da8fa1cb32afb30078af13ae9c0258b62b04272a Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Thu, 9 Dec 2010 16:51:37 -0600 Subject: [PATCH] fix py24 compatibility --- slave/buildslave/commands/repo.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/slave/buildslave/commands/repo.py b/slave/buildslave/commands/repo.py index 45d5d324976..2a61f8b4fef 100644 --- a/slave/buildslave/commands/repo.py +++ b/slave/buildslave/commands/repo.py @@ -5,7 +5,11 @@ from buildslave.commands.base import SourceBaseCommand from buildslave import runprocess -import hashlib +try: + from hashlib import sha1 +except ImportError: + import sha + sha1 = sha.new class Repo(SourceBaseCommand): """Repo specific VC operation. In addition to the arguments @@ -141,6 +145,6 @@ def _doDownload(self, dummy): def parseGotRevision(self): command = ['manifest', '-o', '-'] def _parse(res): - return hashlib.sha1(self.command.stdout).hexdigest() + return sha1(self.command.stdout).hexdigest() return self._repoCmd(command, _parse, keepStdout=True)