# HG changeset patch # User Georges Racinet # Date 1648843172 -7200 # Node ID 6ae0077e416e7a2c779a71a7d93b3d6c8c2340a4 # Parent d2ec9ab1694e53d1b65145a4185e1a88cf8dbdc9 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. diff -r d2ec9ab1694e -r 6ae0077e416e hgext3rd/evolve/state.py --- 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,