diff options
author | Felix Schwarz <felix.schwarz@oss.schwarz.eu> | 2019-05-12 14:44:32 +0200 |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-05-12 21:44:32 +0900 |
commit | 05ff11dbcc8181cc781b121e46e76a01258a32af (patch) | |
tree | c972ea0cbd95fbe7c1f396d9958b5d4419a8f1d1 | |
parent | 737f08a885dcff32aa1a417a45936d7f7810ee37 (diff) | |
download | msgpack-python-05ff11dbcc8181cc781b121e46e76a01258a32af.tar.gz |
use relative imports (#357)
Some applications use msgpack to store persistent data and require a specific
msgpack version (e.g. borgbackup). Bundling helps in case there is an
(incompatible) version of msgpack in a system-wide install.
-rw-r--r-- | msgpack/__init__.py | 10 | ||||
-rw-r--r-- | msgpack/_packer.pyx | 2 | ||||
-rw-r--r-- | msgpack/_unpacker.pyx | 4 | ||||
-rw-r--r-- | msgpack/fallback.py | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/msgpack/__init__.py b/msgpack/__init__.py index 7493c4c..4ad9c1a 100644 --- a/msgpack/__init__.py +++ b/msgpack/__init__.py @@ -1,6 +1,6 @@ # coding: utf-8 -from msgpack._version import version -from msgpack.exceptions import * +from ._version import version +from .exceptions import * from collections import namedtuple @@ -19,12 +19,12 @@ class ExtType(namedtuple('ExtType', 'code data')): import os if os.environ.get('MSGPACK_PUREPYTHON'): - from msgpack.fallback import Packer, unpackb, Unpacker + from .fallback import Packer, unpackb, Unpacker else: try: - from msgpack._cmsgpack import Packer, unpackb, Unpacker + from ._cmsgpack import Packer, unpackb, Unpacker except ImportError: - from msgpack.fallback import Packer, unpackb, Unpacker + from .fallback import Packer, unpackb, Unpacker def pack(o, stream, **kwargs): diff --git a/msgpack/_packer.pyx b/msgpack/_packer.pyx index bfde043..dcee213 100644 --- a/msgpack/_packer.pyx +++ b/msgpack/_packer.pyx @@ -3,7 +3,7 @@ from cpython cimport * from cpython.bytearray cimport PyByteArray_Check, PyByteArray_CheckExact -from msgpack import ExtType +from . import ExtType cdef extern from "Python.h": diff --git a/msgpack/_unpacker.pyx b/msgpack/_unpacker.pyx index 3c6d59e..3727f50 100644 --- a/msgpack/_unpacker.pyx +++ b/msgpack/_unpacker.pyx @@ -12,14 +12,14 @@ from libc.string cimport * from libc.limits cimport * ctypedef unsigned long long uint64_t -from msgpack.exceptions import ( +from .exceptions import ( BufferFull, OutOfData, ExtraData, FormatError, StackError, ) -from msgpack import ExtType +from . import ExtType cdef extern from "unpack.h": diff --git a/msgpack/fallback.py b/msgpack/fallback.py index 1aa3bdf..3836e83 100644 --- a/msgpack/fallback.py +++ b/msgpack/fallback.py @@ -59,7 +59,7 @@ else: newlist_hint = lambda size: [] -from msgpack.exceptions import ( +from .exceptions import ( BufferFull, OutOfData, ExtraData, @@ -67,7 +67,7 @@ from msgpack.exceptions import ( StackError, ) -from msgpack import ExtType +from . import ExtType EX_SKIP = 0 |