2009-06-24 14:33:36 +09:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# coding: utf-8
|
2010-11-03 03:43:49 +09:00
|
|
|
version = (0, 1, 7, 'final')
|
2009-06-24 14:33:36 +09:00
|
|
|
|
2009-06-10 10:45:07 +09:00
|
|
|
import os
|
2010-11-03 03:35:52 +09:00
|
|
|
import sys
|
2010-01-25 20:52:48 +09:00
|
|
|
from glob import glob
|
|
|
|
from distutils.core import setup, Extension
|
|
|
|
from distutils.command.sdist import sdist
|
|
|
|
|
|
|
|
try:
|
|
|
|
from Cython.Distutils import build_ext
|
|
|
|
import Cython.Compiler.Main as cython_compiler
|
|
|
|
have_cython = True
|
|
|
|
except ImportError:
|
|
|
|
from distutils.command.build_ext import build_ext
|
|
|
|
have_cython = False
|
2009-06-08 01:43:50 +09:00
|
|
|
|
2010-09-02 09:54:38 +09:00
|
|
|
# make msgpack/__verison__.py
|
|
|
|
f = open('msgpack/__version__.py', 'w')
|
|
|
|
f.write("version = %r\n" % (version,))
|
|
|
|
f.close()
|
2010-09-02 10:10:34 +09:00
|
|
|
version_str = '.'.join(str(x) for x in version[:3])
|
|
|
|
if len(version) > 3 and version[3] != 'final':
|
|
|
|
version_str += version[3]
|
2009-06-08 01:43:50 +09:00
|
|
|
|
2010-01-25 20:52:48 +09:00
|
|
|
# take care of extension modules.
|
|
|
|
if have_cython:
|
|
|
|
sources = ['msgpack/_msgpack.pyx']
|
|
|
|
|
|
|
|
class Sdist(sdist):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
for src in glob('msgpack/*.pyx'):
|
|
|
|
cython_compiler.compile(glob('msgpack/*.pyx'),
|
|
|
|
cython_compiler.default_options)
|
|
|
|
sdist.__init__(self, *args, **kwargs)
|
|
|
|
else:
|
|
|
|
sources = ['msgpack/_msgpack.c']
|
|
|
|
|
2010-04-29 07:08:41 +09:00
|
|
|
for f in sources:
|
|
|
|
if not os.path.exists(f):
|
|
|
|
raise ImportError("Building msgpack from VCS needs Cython. Install Cython or use sdist package.")
|
|
|
|
|
2010-01-25 20:52:48 +09:00
|
|
|
Sdist = sdist
|
|
|
|
|
2010-11-03 03:35:52 +09:00
|
|
|
libraries = ['ws2_32'] if sys.platform == 'win32' else []
|
|
|
|
|
2009-06-10 10:58:09 +09:00
|
|
|
msgpack_mod = Extension('msgpack._msgpack',
|
2010-01-25 20:52:48 +09:00
|
|
|
sources=sources,
|
2010-11-03 03:35:52 +09:00
|
|
|
libraries=libraries,
|
2009-07-12 09:29:11 +09:00
|
|
|
)
|
2010-11-03 03:35:52 +09:00
|
|
|
del sources, libraries
|
2010-01-25 20:52:48 +09:00
|
|
|
|
2009-06-08 01:43:50 +09:00
|
|
|
|
2009-07-12 09:29:11 +09:00
|
|
|
desc = 'MessagePack (de)serializer.'
|
2010-04-29 07:52:32 +09:00
|
|
|
long_desc = """MessagePack (de)serializer for Python.
|
2009-06-08 01:43:50 +09:00
|
|
|
|
2010-04-29 09:06:46 +09:00
|
|
|
What's MessagePack? (from http://msgpack.sourceforge.net/)
|
2009-06-08 01:43:50 +09:00
|
|
|
|
|
|
|
MessagePack is a binary-based efficient data interchange format that is
|
|
|
|
focused on high performance. It is like JSON, but very fast and small.
|
|
|
|
"""
|
|
|
|
|
2010-04-29 07:52:32 +09:00
|
|
|
setup(name='msgpack-python',
|
2010-01-25 20:52:48 +09:00
|
|
|
author='INADA Naoki',
|
2009-06-08 01:43:50 +09:00
|
|
|
author_email='songofacandy@gmail.com',
|
2010-09-02 10:10:34 +09:00
|
|
|
version=version_str,
|
2010-01-25 20:52:48 +09:00
|
|
|
cmdclass={'build_ext': build_ext, 'sdist': Sdist},
|
2009-06-08 01:43:50 +09:00
|
|
|
ext_modules=[msgpack_mod],
|
2009-06-24 01:13:22 +09:00
|
|
|
packages=['msgpack'],
|
2009-06-08 13:21:38 +09:00
|
|
|
description=desc,
|
2009-06-08 01:43:50 +09:00
|
|
|
long_description=long_desc,
|
2010-04-29 09:06:46 +09:00
|
|
|
url='http://msgpack.sourceforge.net/',
|
2010-04-29 07:08:41 +09:00
|
|
|
download_url='http://pypi.python.org/pypi/msgpack/',
|
2009-07-12 09:29:11 +09:00
|
|
|
classifiers=[
|
2010-11-03 03:35:52 +09:00
|
|
|
'Programming Language :: Python :: 2',
|
2010-09-02 10:13:49 +09:00
|
|
|
'Programming Language :: Python :: 3',
|
2009-07-12 09:29:11 +09:00
|
|
|
'Development Status :: 4 - Beta',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'License :: OSI Approved :: Apache Software License',
|
|
|
|
]
|
2009-06-08 01:43:50 +09:00
|
|
|
)
|