Mercurial > evolve
changeset 6210:6ae0077e416e stable
state: allow to unvendor cbor
This makes evolve fallback to an externally provided version of
the `cbor` library, which in turns allows distributions such as Debian
not to include the vendored `cbor.py` and rely on their own provided
version instead.
The price to pay is the immediate attempt to import the vendored `cbor`,
to circumvent that hgdemandimport never raises `ImportError` immediately.
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Fri, 01 Apr 2022 21:59:32 +0200 |
parents | d2ec9ab1694e |
children | 6faab8daf02a |
files | hgext3rd/evolve/state.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/state.py Sun Mar 06 17:44:11 2022 +0300 +++ b/hgext3rd/evolve/state.py Fri Apr 01 21:59:32 2022 +0200 @@ -19,7 +19,14 @@ import errno import struct -from .thirdparty import cbor +# use the vendored cbor if available, and if not, try and +# use an externally provided one (would typically be the case +# with distribution packages) +try: + from .thirdparty import cbor + cbor.__doc__ # trigger ImportError immediately +except ImportError: + import cbor from mercurial import ( error,