deb_specific__optional-dependencies
authorPython Applications Packaging Team <python-apps-team@lists.alioth.debian.org>
Thu, 25 Jun 2020 10:18:13 +0000 (11:18 +0100)
committerJulien Cristau <jcristau@debian.org>
Thu, 25 Jun 2020 10:18:13 +0000 (11:18 +0100)
Suggest Debian packages for some optional dependencies.

Gbp-Pq: Name deb_specific__optional-dependencies

hgext/bugzilla.py
hgext/convert/bzr.py
hgext/convert/common.py
hgext/convert/cvs.py
hgext/convert/darcs.py
hgext/convert/git.py
hgext/convert/gnuarch.py
hgext/convert/monotone.py
hgext/convert/subversion.py
mercurial/sslutil.py
tests/test-https.t

index cee1e9f8e9ccc74eed69c074fc903537d570a980..dfbd9c09911aeb9f2b9038fc634c87b0d202d26d 100644 (file)
@@ -468,7 +468,8 @@ class bzmysql(bzaccess):
             bzmysql._MySQLdb = mysql
         except ImportError as err:
             raise error.Abort(
-                _(b'python mysql support not available: %s') % err
+                _(b'python mysql support not available: %s') % err +
+                _(b' (try installing the %s package)') % b'python-mysqldb'
             )
 
         bzaccess.__init__(self, ui)
index f7aff9fccb3b7045e71ddff2f6138d9e22c1a3f8..0b3fef3895f0302364de7a511a0dd3e9b3ac799b 100644 (file)
@@ -57,7 +57,8 @@ class bzr_source(common.converter_source):
             # access bzrlib stuff
             bzrdir
         except NameError:
-            raise common.NoRepo(_(b'Bazaar modules could not be loaded'))
+            raise common.NoRepo(_(b'Bazaar modules could not be loaded') +
+                                _(b' (try installing the %s package)') % b'bzr')
 
         path = os.path.abspath(path)
         self._checkrepotype(path)
index afb63b601f594c364347b74a9f23a0be39238030..37d10c3cdf8f124971b99b2d95d5fe96d9d7ea88 100644 (file)
@@ -103,14 +103,15 @@ 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 procutil.findexe(exe):
         if abort:
             exc = error.Abort
         else:
             exc = MissingTool
-        raise exc(_(b'cannot find required "%s" tool') % name)
+        raise exc(_(b'cannot find required "%s" tool') % name +
+                  (debname and _(b' (try installing the %s package)') % debname or b''))
 
 
 class NoRepo(Exception):
index a122b42d05d6a74125aae668f5266c0fab68681a..16cbf270c15c053fc95aa1d59fb3d43dc0dd76ed 100644 (file)
@@ -48,7 +48,7 @@ class convert_cvs(converter_source):
         if not os.path.exists(cvs):
             raise NoRepo(_(b"%s does not look like a CVS checkout") % path)
 
-        checktool(b'cvs')
+        checktool(b'cvs', debname=b'cvs')
 
         self.changeset = None
         self.files = {}
index 7ea0b14ace8dfd25518f7824de9a34c8b5cd3416..4efec57d1a97c64b60453b01057af3ba29e739de 100644 (file)
@@ -53,7 +53,7 @@ class darcs_source(common.converter_source, common.commandline):
         if not os.path.exists(os.path.join(path, b'_darcs')):
             raise NoRepo(_(b"%s does not look like a darcs repository") % path)
 
-        common.checktool(b'darcs')
+        common.checktool(b'darcs', debname=b'darcs')
         version = self.run0(b'--version').splitlines()[0].strip()
         if version < b'2.1':
             raise error.Abort(
@@ -61,7 +61,8 @@ class darcs_source(common.converter_source, common.commandline):
             )
 
         if b"ElementTree" not in globals():
-            raise error.Abort(_(b"Python ElementTree module is not available"))
+            raise error.Abort(_(b"Python ElementTree module is not available") +
+                              _(b" (try installing the %s package)") % b'python-celementtree')
 
         self.path = os.path.realpath(path)
 
index 10f594ebdeaebf664305af8cd95557c9b88b0479..4133cd8f6529a76739ed4240d9480efdeaaafb83 100644 (file)
@@ -100,7 +100,7 @@ class convert_git(common.converter_source, common.commandline):
         else:
             self.simopt = []
 
-        common.checktool(b'git', b'git')
+        common.checktool(b'git', b'git', debname=b'git')
 
         self.path = path
         self.submodules = []
index 8458dfc4fd5cade7d2de31bf7526a4798cb96dd8..117713cb51766c50b433b77a09ad5a4269ba992d 100644 (file)
@@ -57,7 +57,8 @@ class gnuarch_source(common.converter_source, common.commandline):
             if procutil.findexe(b'tla'):
                 self.execmd = b'tla'
             else:
-                raise error.Abort(_(b'cannot find a GNU Arch tool'))
+                raise error.Abort(_(b'cannot find a GNU Arch tool') +
+                                  _(b' (try installing the %s package)') % b'tla')
 
         common.commandline.__init__(self, ui, self.execmd)
 
index aeeca5059b752a192605bd861058d4994c987738..6bd715a2d43239d225fae5df431ba8b9920de11c 100644 (file)
@@ -87,7 +87,7 @@ class monotone_source(common.converter_source, common.commandline):
         self.files = None
         self.dirs = None
 
-        common.checktool(b'mtn', abort=False)
+        common.checktool(b'mtn', abort=False, debname=b'monotone')
 
     def mtnrun(self, *args, **kwargs):
         if self.automatestdio:
index 2123eaae4036dc50c0fd8d0b94f87807dcfb3035..2147f8206d40e730076536e7fbb309806f54bbfb 100644 (file)
@@ -366,7 +366,8 @@ class svn_source(converter_source):
                 _(b"%s does not look like a Subversion repository") % url
             )
         if svn is None:
-            raise MissingTool(_(b'could not load Subversion python bindings'))
+            raise MissingTool(_(b'could not load Subversion python bindings') +
+                              _(b' (try installing the %s package)') % b'python-subversion')
 
         try:
             version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
@@ -376,14 +377,16 @@ class svn_source(converter_source):
                         b'Subversion python bindings %d.%d found, '
                         b'1.4 or later required'
                     )
-                    % version
+                    % version +
+                    _(b' (try upgrading the %s package)') % b'python-subversion'
                 )
         except AttributeError:
             raise MissingTool(
                 _(
                     b'Subversion python bindings are too old, 1.4 '
                     b'or later required'
-                )
+                ) +
+                _(b' (try upgrading the %s package)') % b'python-subversion'
             )
 
         self.lastrevs = {}
@@ -1288,6 +1291,8 @@ class svn_sink(converter_sink, commandline):
         return self.join(b'hg-authormap')
 
     def __init__(self, ui, repotype, path):
+        common.checktool(b'svn', debname=b'subversion')
+        common.checktool(b'svnadmin', debname=b'subversion')
 
         converter_sink.__init__(self, ui, repotype, path)
         commandline.__init__(self, ui, b'svn')
index d838a18a02dd74dc99a7730d658518453b633d41..40a81fa6abe6f7716b7f265456f23331433b9b7e 100644 (file)
@@ -276,7 +276,8 @@ def _hostsettings(ui, hostname):
                 cafile = util.expandpath(cafile)
                 if not os.path.exists(cafile):
                     raise error.Abort(
-                        _(b'could not find web.cacerts: %s') % cafile
+                        _(b'could not find web.cacerts: %s') % cafile +
+                        _(b' (try installing the %s package)') % b'ca-certificates'
                     )
             elif s[b'allowloaddefaultcerts']:
                 # CAs not defined in config. Try to find system bundles.
index a2cc863772530389c9802903604749c8a6ae9b1d..382abe0dd8190b6a8d10d48536ad936b337954aa 100644 (file)
@@ -35,7 +35,7 @@ cacert not found
 
   $ hg in --config web.cacerts=no-such.pem https://localhost:$HGPORT/
   warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
-  abort: could not find web.cacerts: no-such.pem
+  abort: could not find web.cacerts: no-such.pem (try installing the ca-certificates package)
   [255]
 
 Test server address cannot be reused