[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Better error message for svn bindings import in mailer.py.

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Tue, 13 Feb 2018 19:20:00 +0000

Karl Fogel wrote on Mon, 12 Feb 2018 15:04 -0600:
> +++ tools/hook-scripts/mailer/mailer.py (working copy)
> @@ -70,23 +70,21 @@
> _MIN_SVN_VERSION = [1, 5, 0]
>
> # Import the Subversion Python bindings, making sure they meet our
> # minimum version requirements.
> try:
> import svn.fs
> import svn.delta
> import svn.repos
> import svn.core
> except ImportError:
> - sys.stderr.write(
> - "You need version %s or better of the Subversion Python bindings.\n" \
> - % ".".join([str(x) for x in _MIN_SVN_VERSION]))
> + sys.stderr.write("Unable to import Subversion Python bindings.\n")
> sys.exit(1)

It would be useful to also print the caught exception in case it contains more
specific information about the cause of the problem…

… but in that case, why not remove the try/except entirely?

> if _MIN_SVN_VERSION > [svn.core.SVN_VER_MAJOR,
> svn.core.SVN_VER_MINOR,
> svn.core.SVN_VER_PATCH]:
> sys.stderr.write(
> "You need version %s or better of the Subversion Python bindings.\n" \
> % ".".join([str(x) for x in _MIN_SVN_VERSION]))
> sys.exit(1)
Received on 2018-02-13 20:20:07 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.