commit 43c500bf080eb1d1df0df1d6b6ccd7e801c663dd
Author: Your Name <you@example.com>
Date: Thu May 9 21:28:21 2019 +0200
use relative imports
This makes it possible to vendorize msgpack (with a different module name) more easily.
diff --git a/msgpack/__init__.py b/msgpack/__init__.py
index 3955a41..3a3cf3a 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,13 +19,13 @@ 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._packer import Packer
- from msgpack._unpacker import unpackb, Unpacker
+ from ._packer import Packer
+ from ._unpacker import 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 225f24a..c490a5b 100644
--- a/msgpack/_packer.pyx
+++ b/msgpack/_packer.pyx
@@ -5,8 +5,8 @@ from cpython cimport *
from cpython.version cimport PY_MAJOR_VERSION
from cpython.exc cimport PyErr_WarnEx
-from msgpack.exceptions import PackValueError, PackOverflowError
-from msgpack import ExtType
+from .exceptions import PackValueError, PackOverflowError
+from . import ExtType
cdef extern from "Python.h":
diff --git a/msgpack/_unpacker.pyx b/msgpack/_unpacker.pyx
index d7fa5bc..0abd9c1 100644
--- a/msgpack/_unpacker.pyx
+++ b/msgpack/_unpacker.pyx
@@ -32,13 +32,13 @@ from libc.string cimport *
from libc.limits cimport *
ctypedef unsigned long long uint64_t
-from msgpack.exceptions import (
+from .exceptions import (
BufferFull,
OutOfData,
UnpackValueError,
ExtraData,
)
-from msgpack import ExtType
+from . import ExtType
cdef extern from "unpack.h":
diff --git a/msgpack/fallback.py b/msgpack/fallback.py
index c0e5fd6..fd01bf8 100644
--- a/msgpack/fallback.py
+++ b/msgpack/fallback.py
@@ -49,7 +49,7 @@ else:
newlist_hint = lambda size: []
-from msgpack.exceptions import (
+from .exceptions import (
BufferFull,
OutOfData,
UnpackValueError,
@@ -57,7 +57,7 @@ from msgpack.exceptions import (
PackOverflowError,
ExtraData)
-from msgpack import ExtType
+from . import ExtType
EX_SKIP = 0
diff --git a/msgpack/unpack_define.h b/msgpack/unpack_define.h
index 0dd708d..d681277 100644
--- a/msgpack/unpack_define.h
+++ b/msgpack/unpack_define.h
@@ -18,7 +18,7 @@
#ifndef MSGPACK_UNPACK_DEFINE_H__
#define MSGPACK_UNPACK_DEFINE_H__
-#include "msgpack/sysdep.h"
+#include "sysdep.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>