Suggest Debian packages for some optional dependencies. --- a/hgext/bugzilla.py +++ b/hgext/bugzilla.py @@ -421,7 +421,8 @@ global MySQLdb MySQLdb = mysql except ImportError, err: - raise util.Abort(_('python mysql support not available: %s') % err) + raise util.Abort(_('python mysql support not available: %s') % err + + _(' (try installing the %s package)') % 'python-mysqldb') if node is None: raise util.Abort(_('hook type %s does not pass a changeset id') % --- a/hgext/convert/bzr.py +++ b/hgext/convert/bzr.py @@ -42,7 +42,8 @@ # access bzrlib stuff branch except NameError: - raise NoRepo('Bazaar modules could not be loaded') + raise NoRepo('Bazaar modules could not be loaded' + + _(' (try installing the %s package)') % 'bzr') path = os.path.abspath(path) self._checkrepotype(path) --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -26,11 +26,12 @@ class MissingTool(Exception): pass -def checktool(exe, name=None, abort=True): +def checktool(exe, name=None, abort=True, debname=None): name = name or exe if not util.find_exe(exe): exc = abort and util.Abort or MissingTool - raise exc(_('cannot find required "%s" tool') % name) + raise exc(_('cannot find required "%s" tool') % name + + (debname and _(' (try installing the %s package)') % debname or '')) class NoRepo(Exception): pass --- a/hgext/convert/cvs.py +++ b/hgext/convert/cvs.py @@ -21,7 +21,7 @@ if not os.path.exists(cvs): raise NoRepo("%s does not look like a CVS checkout" % path) - checktool('cvs') + checktool('cvs', debname='cvs') self.changeset = None self.files = {} --- a/hgext/convert/darcs.py +++ b/hgext/convert/darcs.py @@ -35,14 +35,15 @@ if not os.path.exists(os.path.join(path, '_darcs')): raise NoRepo("%s does not look like a darcs repo" % path) - checktool('darcs') + checktool('darcs', debname='darcs') version = self.run0('--version').splitlines()[0].strip() if version < '2.1': raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') % version) if ElementTree is None: - raise util.Abort(_("Python ElementTree module is not available")) + raise util.Abort(_("Python ElementTree module is not available") + + _(" (try installing the %s package)") % 'python-celementtree') self.path = os.path.realpath(path) --- a/hgext/convert/git.py +++ b/hgext/convert/git.py @@ -37,7 +37,7 @@ if not os.path.exists(path + "/objects"): raise NoRepo("%s does not look like a Git repo" % path) - checktool('git', 'git') + checktool('git', 'git', debname='git-core') self.path = path --- a/hgext/convert/gnuarch.py +++ b/hgext/convert/gnuarch.py @@ -41,7 +41,8 @@ if util.find_exe('tla'): self.execmd = 'tla' else: - raise util.Abort(_('cannot find a GNU Arch tool')) + raise util.Abort(_('cannot find a GNU Arch tool') + + _(' (try installing the %s package)') % 'tla') commandline.__init__(self, ui, self.execmd) --- a/hgext/convert/monotone.py +++ b/hgext/convert/monotone.py @@ -55,7 +55,7 @@ self.files = None self.dirs = None - checktool('mtn', abort=False) + checktool('mtn', abort=False, debname='monotone') # test if there are any revisions self.rev = None --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -21,6 +21,7 @@ from common import NoRepo, MissingTool, commit, encodeargs, decodeargs from common import commandline, converter_source, converter_sink, mapfile +from common import checktool try: from svn.core import SubversionException, Pool @@ -212,16 +213,19 @@ try: SubversionException except NameError: - raise MissingTool(_('Subversion python bindings could not be loaded')) + raise MissingTool(_('Subversion python bindings could not be loaded') + + _(' (try installing the %s package)') % 'python-subversion') try: version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR if version < (1, 4): raise MissingTool(_('Subversion python bindings %d.%d found, ' - '1.4 or later required') % version) + '1.4 or later required') % version + + _(' (try upgrading the %s package)') % 'python-subversion') except AttributeError: raise MissingTool(_('Subversion python bindings are too old, 1.4 ' - 'or later required')) + 'or later required') + + _(' (try upgrading the %s package)') % 'python-subversion') self.lastrevs = {} @@ -952,6 +956,9 @@ return self.join('hg-authormap') def __init__(self, ui, path): + checktool('svn', debname='subversion') + checktool('svnadmin', debname='subversion') + converter_sink.__init__(self, ui, path) commandline.__init__(self, ui, 'svn') self.delete = [] --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -260,7 +260,8 @@ from OpenSSL import SSL ctx = SSL.Context(SSL.SSLv23_METHOD) except ImportError: - raise util.Abort(_("SSL support is unavailable")) + raise util.Abort(_("SSL support is unavailable") + + _(" (try installing the %s package)") % 'python-openssl') ctx.use_privatekey_file(ssl_cert) ctx.use_certificate_file(ssl_cert) sock = socket.socket(self.address_family, self.socket_type)