jhbuild r2452 - in trunk: . jhbuild jhbuild/versioncontrol
- From: fpeters svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r2452 - in trunk: . jhbuild jhbuild/versioncontrol
- Date: Sat, 1 Nov 2008 22:07:45 +0000 (UTC)
Author: fpeters
Date: Sat Nov 1 22:07:44 2008
New Revision: 2452
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2452&view=rev
Log:
* jhbuild/errors.py, jhbuild/main.py, jhbuild/versioncontrol/cvs.py,
jhbuild/versioncontrol/darcs.py, jhbuild/versioncontrol/tarball.py:
updated to remove things that got deprecated in Python 2.6 (while
keeping it compatible with 2.3 at least). (closes: #558216)
Modified:
trunk/ChangeLog
trunk/jhbuild/errors.py
trunk/jhbuild/main.py
trunk/jhbuild/versioncontrol/cvs.py
trunk/jhbuild/versioncontrol/darcs.py
trunk/jhbuild/versioncontrol/tarball.py
Modified: trunk/jhbuild/errors.py
==============================================================================
--- trunk/jhbuild/errors.py (original)
+++ trunk/jhbuild/errors.py Sat Nov 1 22:07:44 2008
@@ -19,10 +19,8 @@
class JhbuildException(Exception):
- # compatibility class to have exception.message for Python < 2.5
- def __init__(self, message = None):
- Exception.__init__(self, message)
- self.message = message
+ pass
+
class UsageError(JhbuildException):
'''An exception that should result in a usage message rather than
Modified: trunk/jhbuild/main.py
==============================================================================
--- trunk/jhbuild/main.py (original)
+++ trunk/jhbuild/main.py Sat Nov 1 22:07:44 2008
@@ -115,7 +115,7 @@
try:
config = jhbuild.config.Config(options.configfile)
except FatalError, exc:
- sys.stderr.write('jhbuild: %s\n' % exc.message.encode(_encoding, 'replace'))
+ sys.stderr.write('jhbuild: %s\n' % exc.args[0].encode(_encoding, 'replace'))
sys.exit(1)
if options.moduleset: config.moduleset = options.moduleset
@@ -132,11 +132,11 @@
try:
rc = jhbuild.commands.run(command, config, args)
except UsageError, exc:
- sys.stderr.write('jhbuild %s: %s\n' % (command, exc.message.encode(_encoding, 'replace')))
+ sys.stderr.write('jhbuild %s: %s\n' % (command, exc.args[0].encode(_encoding, 'replace')))
parser.print_usage()
sys.exit(1)
except FatalError, exc:
- sys.stderr.write('jhbuild %s: %s\n' % (command, exc.message.encode(_encoding, 'replace')))
+ sys.stderr.write('jhbuild %s: %s\n' % (command, exc.args[0].encode(_encoding, 'replace')))
sys.exit(1)
except KeyboardInterrupt:
uprint(_('Interrupted'))
Modified: trunk/jhbuild/versioncontrol/cvs.py
==============================================================================
--- trunk/jhbuild/versioncontrol/cvs.py (original)
+++ trunk/jhbuild/versioncontrol/cvs.py Sat Nov 1 22:07:44 2008
@@ -26,7 +26,10 @@
import sys
import os
-import md5
+try:
+ import hashlib
+except ImportError:
+ import md5 as hashlib
import git
@@ -316,7 +319,7 @@
def tree_id(self):
if not os.path.exists(self.srcdir):
return None
- md5sum = md5.new()
+ md5sum = hashlib.md5()
_process_directory(self.srcdir, '', md5sum.update)
return 'jhbuild-cvs-treeid:%s' % md5sum.hexdigest()
Modified: trunk/jhbuild/versioncontrol/darcs.py
==============================================================================
--- trunk/jhbuild/versioncontrol/darcs.py (original)
+++ trunk/jhbuild/versioncontrol/darcs.py Sat Nov 1 22:07:44 2008
@@ -20,10 +20,14 @@
__all__ = []
__metaclass__ = type
-import md5
import os
import urlparse
+try:
+ import hashlib
+except ImportError:
+ import md5 as hashlib
+
from jhbuild.errors import FatalError, CommandError
from jhbuild.versioncontrol import Repository, Branch, register_repo_type
from jhbuild.commands.sanitycheck import inpath
@@ -114,6 +118,6 @@
# this
if not os.path.exists(self.srcdir):
return None
- return md5.md5(file(os.path.join(self.srcdir, '_darcs', 'inventory')).read()).hexdigest()
+ return hashlib.md5(file(os.path.join(self.srcdir, '_darcs', 'inventory')).read()).hexdigest()
register_repo_type('darcs', DarcsRepository)
Modified: trunk/jhbuild/versioncontrol/tarball.py
==============================================================================
--- trunk/jhbuild/versioncontrol/tarball.py (original)
+++ trunk/jhbuild/versioncontrol/tarball.py Sat Nov 1 22:07:44 2008
@@ -21,7 +21,10 @@
__metaclass__ = type
import os
-import md5
+try:
+ import hashlib
+except ImportError:
+ import md5 as hashlib
import urlparse
import urllib2
@@ -149,8 +152,7 @@
_('downloaded file size is incorrect (expected %(size1)d, got %(size2)d)')
% {'size1':self.source_size, 'size2':local_size})
if self.source_md5 is not None:
- import md5
- local_md5 = md5.new()
+ local_md5 = hashlib.md5()
fp = open(localfile, 'rb')
data = fp.read(32768)
while data:
@@ -263,7 +265,7 @@
self._quilt_checkout(buildscript)
def tree_id(self):
- md5sum = md5.new()
+ md5sum = hashlib.md5()
if self.patches:
for patch in self.patches:
md5sum.update(patch[0])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]