diff options
author | INADA Naoki <songofacandy@gmail.com> | 2018-10-03 20:55:51 +0900 |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2018-11-08 20:27:35 +0900 |
commit | f6f95972492bcb83d8fe4c63be3b96d46e47bab7 (patch) | |
tree | e0003078b772d6c0e3a22862f8494bb723388a97 | |
parent | 91ec9e1daf5cc915a47e2b356a7b1dd9662573a3 (diff) | |
download | msgpack-python-f6f95972492bcb83d8fe4c63be3b96d46e47bab7.tar.gz |
Merge extension module
There were `_packer.so` and `_unpacker.so`.
But single module is simpler than double module.
Merge extension module into single `_msgpack.so`.
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | msgpack/__init__.py | 3 | ||||
-rw-r--r-- | msgpack/_msgpack.pyx | 4 | ||||
-rwxr-xr-x | setup.py | 13 |
4 files changed, 10 insertions, 15 deletions
@@ -4,7 +4,7 @@ all: cython .PHONY: cython cython: - cython --cplus msgpack/*.pyx + cython --cplus msgpack/_msgpack.pyx .PHONY: test test: @@ -18,8 +18,7 @@ serve-doc: all .PHONY: clean clean: rm -rf build - rm -f msgpack/_packer.cpp - rm -f msgpack/_unpacker.cpp + rm -f msgpack/_msgpack.cpp rm -rf msgpack/__pycache__ rm -rf test/__pycache__ diff --git a/msgpack/__init__.py b/msgpack/__init__.py index 3955a41..7c5d4c0 100644 --- a/msgpack/__init__.py +++ b/msgpack/__init__.py @@ -22,8 +22,7 @@ if os.environ.get('MSGPACK_PUREPYTHON'): from msgpack.fallback import Packer, unpackb, Unpacker else: try: - from msgpack._packer import Packer - from msgpack._unpacker import unpackb, Unpacker + from msgpack._msgpack import Packer, unpackb, Unpacker except ImportError: from msgpack.fallback import Packer, unpackb, Unpacker diff --git a/msgpack/_msgpack.pyx b/msgpack/_msgpack.pyx new file mode 100644 index 0000000..4381394 --- /dev/null +++ b/msgpack/_msgpack.pyx @@ -0,0 +1,4 @@ +# coding: utf-8 +#cython: embedsignature=True, c_string_encoding=ascii +include "_packer.pyx" +include "_unpacker.pyx" @@ -68,8 +68,7 @@ if len(version) > 3 and version[3] != 'final': if have_cython: class Sdist(sdist): def __init__(self, *args, **kwargs): - for src in glob('msgpack/*.pyx'): - cythonize(src) + cythonize('msgpack/_msgpack.pyx') sdist.__init__(self, *args, **kwargs) else: Sdist = sdist @@ -85,14 +84,8 @@ else: ext_modules = [] if not hasattr(sys, 'pypy_version_info'): - ext_modules.append(Extension('msgpack._packer', - sources=['msgpack/_packer.cpp'], - libraries=libraries, - include_dirs=['.'], - define_macros=macros, - )) - ext_modules.append(Extension('msgpack._unpacker', - sources=['msgpack/_unpacker.cpp'], + ext_modules.append(Extension('msgpack._msgpack', + sources=['msgpack/_msgpack.cpp'], libraries=libraries, include_dirs=['.'], define_macros=macros, |