Skip to content

Commit

Permalink
use relative imports (#357)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
FelixSchwarz authored and methane committed May 12, 2019
1 parent 737f08a commit 05ff11d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions msgpack/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -19,12 +19,12 @@ def __new__(cls, 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):
Expand Down
2 changes: 1 addition & 1 deletion msgpack/_packer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 2 additions & 2 deletions msgpack/_unpacker.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 2 additions & 2 deletions msgpack/fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ def getvalue(self):
newlist_hint = lambda size: []


from msgpack.exceptions import (
from .exceptions import (
BufferFull,
OutOfData,
ExtraData,
FormatError,
StackError,
)

from msgpack import ExtType
from . import ExtType


EX_SKIP = 0
Expand Down

0 comments on commit 05ff11d

Please sign in to comment.