forked from dln/python-libuuid
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
73 lines (64 loc) · 2.47 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""C Extension for faster UUID generation using libuuid."""
__version_info__ = (1, 0, 0)
__version__ = ".".join(map(str, __version_info__))
__author__ = "Brad Davidson"
__contact__ = "brad@oatmail.org"
__homepage__ = "http://github.com/brandond/python-libuuid/"
__docformat__ = "restructuredtext"
import codecs
import os
from glob import glob
from setuptools import setup
from distutils.core import Extension
from distutils.command.sdist import sdist
extra_setup_args = {}
try:
from Cython.Build import cythonize
import Cython.Compiler.Version
import Cython.Compiler.Main as cython_compiler
print("building with Cython " + Cython.Compiler.Version.version)
class Sdist(sdist):
def __init__(self, *args, **kwargs):
for src in glob('libuuid/*.pyx'):
cython_compiler.compile(glob('libuuid/*.pyx'),
cython_compiler.default_options)
sdist.__init__(self, *args, **kwargs)
extra_setup_args['cmdclass'] = {'sdist': Sdist}
source_extension = ".pyx"
except ImportError as e:
print("building without Cython")
cythonize = lambda obj: [obj]
source_extension = ".c"
libuuid_extension = Extension('libuuid._uuid',
sources=['libuuid/_uuid' + source_extension],
libraries=['uuid'])
long_description = '\n' + codecs.open('README.rst', "r", "utf-8").read()
setup(name = 'libuuid',
version = __version__,
description = __doc__,
author = __author__,
author_email = __contact__,
license = 'BSD',
url = __homepage__,
packages = ['libuuid'],
package_dir = {'libuuid': 'libuuid'},
install_requires = ['cython'],
ext_modules = cythonize(libuuid_extension),
zip_safe = False,
test_suite = "nose.collector",
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Programming Language :: Cython",
"License :: OSI Approved :: BSD License",
"Intended Audience :: Developers",
"Topic :: Communications",
"Topic :: System :: Distributed Computing",
"Topic :: Software Development :: Libraries :: Python Modules",
],
long_description = long_description,
**extra_setup_args
)