Skip to content

Commit 05ff11d

Browse files
FelixSchwarzmethane
authored andcommitted
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.
1 parent 737f08a commit 05ff11d

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

msgpack/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding: utf-8
2-
from msgpack._version import version
3-
from msgpack.exceptions import *
2+
from ._version import version
3+
from .exceptions import *
44

55
from collections import namedtuple
66

@@ -19,12 +19,12 @@ def __new__(cls, code, data):
1919

2020
import os
2121
if os.environ.get('MSGPACK_PUREPYTHON'):
22-
from msgpack.fallback import Packer, unpackb, Unpacker
22+
from .fallback import Packer, unpackb, Unpacker
2323
else:
2424
try:
25-
from msgpack._cmsgpack import Packer, unpackb, Unpacker
25+
from ._cmsgpack import Packer, unpackb, Unpacker
2626
except ImportError:
27-
from msgpack.fallback import Packer, unpackb, Unpacker
27+
from .fallback import Packer, unpackb, Unpacker
2828

2929

3030
def pack(o, stream, **kwargs):

msgpack/_packer.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from cpython cimport *
44
from cpython.bytearray cimport PyByteArray_Check, PyByteArray_CheckExact
55

6-
from msgpack import ExtType
6+
from . import ExtType
77

88

99
cdef extern from "Python.h":

msgpack/_unpacker.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ from libc.string cimport *
1212
from libc.limits cimport *
1313
ctypedef unsigned long long uint64_t
1414

15-
from msgpack.exceptions import (
15+
from .exceptions import (
1616
BufferFull,
1717
OutOfData,
1818
ExtraData,
1919
FormatError,
2020
StackError,
2121
)
22-
from msgpack import ExtType
22+
from . import ExtType
2323

2424

2525
cdef extern from "unpack.h":

msgpack/fallback.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ def getvalue(self):
5959
newlist_hint = lambda size: []
6060

6161

62-
from msgpack.exceptions import (
62+
from .exceptions import (
6363
BufferFull,
6464
OutOfData,
6565
ExtraData,
6666
FormatError,
6767
StackError,
6868
)
6969

70-
from msgpack import ExtType
70+
from . import ExtType
7171

7272

7373
EX_SKIP = 0

0 commit comments

Comments
 (0)