deb_specific__optional-dependencies
authorPython Applications Packaging Team <python-apps-team@lists.alioth.debian.org>
Sun, 16 Aug 2020 09:03:07 +0000 (11:03 +0200)
committerJulien Cristau <jcristau@debian.org>
Mon, 1 Feb 2021 16:47:09 +0000 (16:47 +0000)
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..5a8b901af4facaea53d281c0d6f6be3a13f3b026 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'python3-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 29d7be88ccf1f8c0c99bcc7653612a1d02797f60..d36891c4d1f154458d15ab93cfc3dceeeb660891 100644 (file)
@@ -111,14 +111,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 685d5586bef97dadd388b1595a188262b3c6faee..74e057617697b778aab610bb94deeac74aa30a0e 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..f061ef647f4d1b674aa86e0244a598927b3f02a2 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(
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 67dab4bbba3ea8664fc0c77a67fbaef1fa794e9e..0a54c337640b459e8252474437bd1133d3b52016 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 a00cdf84b0f0d79afe6830c37f8c949351b948fc..8daa1c104d8c968ce11cd5d048a672373db6bac4 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 b67a7244ac1202e415274900934f868878daed0e..47e09700120c8eb1492d37105f80bb1c33756a58 100644 (file)
@@ -483,7 +483,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'python3-subversion')
 
         try:
             version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
@@ -493,14 +494,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 = {}
@@ -1419,6 +1422,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 e606c4457ffe8131f54fabcf67a723a530104091..fc4ed0451027808f044a08ec0688b720f006e27a 100644 (file)
@@ -199,7 +199,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 fa98126100652e91ec6bdd278832aaafbd87eb80..f568b19e8bbe413cc639d4a2b6db72c6068ef017 100644 (file)
@@ -34,7 +34,7 @@ Make server certificates:
 cacert not found
 
   $ hg in --config web.cacerts=no-such.pem https://localhost:$HGPORT/
-  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