mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-20 20:33:17 +00:00
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.
This commit is contained in:
parent
737f08a885
commit
05ff11dbcc
4 changed files with 10 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from msgpack._version import version
|
from ._version import version
|
||||||
from msgpack.exceptions import *
|
from .exceptions import *
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@ class ExtType(namedtuple('ExtType', 'code data')):
|
||||||
|
|
||||||
import os
|
import os
|
||||||
if os.environ.get('MSGPACK_PUREPYTHON'):
|
if os.environ.get('MSGPACK_PUREPYTHON'):
|
||||||
from msgpack.fallback import Packer, unpackb, Unpacker
|
from .fallback import Packer, unpackb, Unpacker
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
from msgpack._cmsgpack import Packer, unpackb, Unpacker
|
from ._cmsgpack import Packer, unpackb, Unpacker
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from msgpack.fallback import Packer, unpackb, Unpacker
|
from .fallback import Packer, unpackb, Unpacker
|
||||||
|
|
||||||
|
|
||||||
def pack(o, stream, **kwargs):
|
def pack(o, stream, **kwargs):
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
from cpython cimport *
|
from cpython cimport *
|
||||||
from cpython.bytearray cimport PyByteArray_Check, PyByteArray_CheckExact
|
from cpython.bytearray cimport PyByteArray_Check, PyByteArray_CheckExact
|
||||||
|
|
||||||
from msgpack import ExtType
|
from . import ExtType
|
||||||
|
|
||||||
|
|
||||||
cdef extern from "Python.h":
|
cdef extern from "Python.h":
|
||||||
|
|
|
@ -12,14 +12,14 @@ from libc.string cimport *
|
||||||
from libc.limits cimport *
|
from libc.limits cimport *
|
||||||
ctypedef unsigned long long uint64_t
|
ctypedef unsigned long long uint64_t
|
||||||
|
|
||||||
from msgpack.exceptions import (
|
from .exceptions import (
|
||||||
BufferFull,
|
BufferFull,
|
||||||
OutOfData,
|
OutOfData,
|
||||||
ExtraData,
|
ExtraData,
|
||||||
FormatError,
|
FormatError,
|
||||||
StackError,
|
StackError,
|
||||||
)
|
)
|
||||||
from msgpack import ExtType
|
from . import ExtType
|
||||||
|
|
||||||
|
|
||||||
cdef extern from "unpack.h":
|
cdef extern from "unpack.h":
|
||||||
|
|
|
@ -59,7 +59,7 @@ else:
|
||||||
newlist_hint = lambda size: []
|
newlist_hint = lambda size: []
|
||||||
|
|
||||||
|
|
||||||
from msgpack.exceptions import (
|
from .exceptions import (
|
||||||
BufferFull,
|
BufferFull,
|
||||||
OutOfData,
|
OutOfData,
|
||||||
ExtraData,
|
ExtraData,
|
||||||
|
@ -67,7 +67,7 @@ from msgpack.exceptions import (
|
||||||
StackError,
|
StackError,
|
||||||
)
|
)
|
||||||
|
|
||||||
from msgpack import ExtType
|
from . import ExtType
|
||||||
|
|
||||||
|
|
||||||
EX_SKIP = 0
|
EX_SKIP = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue