Go to the documentation of this file.00001 from distutils.core import setup, Extension
00002 import distutils.sysconfig
00003 import shutil
00004 import os.path
00005 import re
00006 import sys
00007
00008 CLASSIFIERS = filter(None, map(str.strip,
00009 """
00010 Development Status :: 5 - Production/Stable
00011 Intended Audience :: Developers
00012 License :: OSI Approved :: BSD License
00013 Programming Language :: C
00014 Programming Language :: Python :: 2.4
00015 Programming Language :: Python :: 2.5
00016 Programming Language :: Python :: 2.6
00017 Programming Language :: Python :: 2.7
00018 Programming Language :: Python :: 3
00019 Programming Language :: Python :: 3.2
00020 """.splitlines()))
00021
00022 try:
00023 shutil.rmtree("./build")
00024 except(OSError):
00025 pass
00026
00027 module1 = Extension('ujson',
00028 sources = ['./python/ujson.c',
00029 './python/objToJSON.c',
00030 './python/JSONtoObj.c',
00031 './lib/ultrajsonenc.c',
00032 './lib/ultrajsondec.c'],
00033 include_dirs = ['./python', './lib'])
00034
00035 def get_version():
00036 filename = os.path.join(os.path.dirname(__file__), './python/version.h')
00037 file = None
00038 try:
00039 file = open(filename)
00040 header = file.read()
00041 finally:
00042 if file:
00043 file.close()
00044 m = re.search(r'#define\s+UJSON_VERSION\s+"(\d+\.\d+(?:\.\d+)?)"', header)
00045 assert m, "version.h must contain UJSON_VERSION macro"
00046 return m.group(1)
00047
00048 setup (name = 'ujson',
00049 version = get_version(),
00050 description = "Ultra fast JSON encoder and decoder for Python",
00051 ext_modules = [module1],
00052 author="Jonas Tarnstrom",
00053 author_email="jonas.tarnstrom@esn.me",
00054 download_url="http://github.com/esnme/ultrajson",
00055 license="BSD License",
00056 platforms=['any'],
00057 url="http://www.esn.me",
00058 classifiers=CLASSIFIERS,
00059 )
00060
00061 if sys.version_info[0] >= 3:
00062 print( "*" * 100)
00063 print("If you want to run the tests be sure to run 2to3 on them first, "
00064 "e.g. `2to3 -w tests/tests.py`.")
00065 print("*" * 100)
00066