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>
Thu, 3 Feb 2022 10:01:46 +0000 (10:01 +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 c15beb2fca879728fc0b7462a2d3a15c5eff8b2a..5f03b752f88c4299fdb86c5f0c6e8ab8e87f08c4 100644 (file)
@@ -504,7 +504,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 df5ef296ed38d58be555739a24c0854c26df7932..f09ab22efe738b46900541695fcdb8632b28563c 100644 (file)
@@ -64,7 +64,8 @@ class bzr_source(common.converter_source):
             # access breezy 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 = util.abspath(path)
         self._checkrepotype(path)
index 1f8d6dc8468ddc319b18e386e760b61dc9db2be2..61ef62aa3eef9de924f18fe90f3dcf29c28f5d13 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 83613160744e0759ca2d3b56199aae9f73521762..20d2921a4aa4dbace36882dfab7c52e11a61e54f 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 57444a59cfab7b57729b5478985eeee46c9b5555..2bc76b654f965efa5f8a70342e80476615680196 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 fdb1a306427a4dd4e60c05311ace33ad57d96710..9e03fc19b870b4c68542ca912fb225bb0fdc34cd 100644 (file)
@@ -101,7 +101,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 99ea3451af4e2322d8635d41621fb4da130d3c2e..5ff9ef9cbe02898c9b9833259af811d2ef8b66d9 100644 (file)
@@ -494,7 +494,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
@@ -504,14 +505,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 = {}
@@ -1436,6 +1439,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 b8c2196166416a923a363e23f1c5f523f431305d..f675d926fa9835596af2e5287523aa0000162c21 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 8070f72f839aed75ccd3805684ecb5355f51be7a..7682e8071051ed38693ca4f9b49241dbab0ec604 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