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, 11 Jul 2022 13:19:13 +0000 (14:19 +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 ff9979a7f6240aa55ff85916de8297c182629d82..16a3549957d244f1db746481c445db5b724697d7 100644 (file)
@@ -503,7 +503,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 a22c3220db5c61228a590f8d1dc613ac6e434d60..607393c30e1f525b5fac21e76f6c06ce68f9d45b 100644 (file)
@@ -62,7 +62,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 e1a607c94b2db3be696cf72e59a7c55fafdce6ee..beaa7686e008657964bb5dfa13c6e496f8ed557d 100644 (file)
@@ -89,14 +89,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 ebbc8adb88e61c3a66343895246afebf74bf0342..7347d0e846c9cb7cc9938eb4ded74c72efde5b4f 100644 (file)
@@ -46,7 +46,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 00d68058e6f5ddfb52d1b1eda25fb553982ff4f3..8c29c4b996c1a66255007af9d9f1f4ec03b30380 100644 (file)
@@ -35,7 +35,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 2a9ca4c59df280c1938cd679f33883a7808d7bad..1f57182bed72726573e00f32b44c3dc3d45cb34d 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 b845b261f64e7eddf368eb8636b1aaea5108d9a8..06a7d75d67d27a8774205813e13c0ca358727f79 100644 (file)
@@ -56,7 +56,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 61e4669fc9a8213bb9dc3413d95fc09855e0a8ec..a12c545587f16e7223cc1b07e8c3c78505367b60 100644 (file)
@@ -86,7 +86,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 940e0719923597d065efc1d681cec5d8538a8bb6..ea728fe5d87667b94f3d0b221f88b5a03ad2f133 100644 (file)
@@ -474,7 +474,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
@@ -484,14 +485,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 = {}
@@ -1416,6 +1419,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 dc2d53f6c1e4d34c26d30b4b3592ff8ca8e780af..cf35a275de77b466e8ac65c2140448f7bacb576d 100644 (file)
@@ -207,7 +207,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 579c938e63a21f776101b32d931b6935d2854456..b2e48760d3313857361d577124c6f3b1c6e7ae32 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