forked from piqueserver/pyenet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
77 lines (57 loc) · 1.97 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
74
75
76
77
from setuptools import setup
from distutils.extension import Extension
from distutils.core import run_setup
import os
import glob
import sys
import re
source_files = ["enet.pyx"]
_enet_files = glob.glob("enet/*.c")
source_files.extend(_enet_files)
lib_version = "1.3.14"
package_version = lib_version # + '.post7'
with open('README.rst') as f:
long_description = re.sub(r'[^\x00-\x7F]+', ' ', f.read())
from distutils.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext):
def run(self):
from Cython.Build import cythonize
compiler_directives = {'language_level': 2}
self.extensions = cythonize(self.extensions,
compiler_directives=compiler_directives)
_build_ext.run(self)
extra_args = sys.argv[2:]
run_setup(os.path.join(os.getcwd(), "setup.py"), ['build_py'] + extra_args)
define_macros = [('HAS_POLL', None), ('HAS_FCNTL', None),
('HAS_MSGHDR_FLAGS', None), ('HAS_SOCKLEN_T', None)]
libraries = []
if sys.platform == 'win32':
define_macros.extend([('WIN32', None)])
libraries.extend(['enet64', 'Winmm', 'ws2_32'])
if sys.platform != 'darwin':
define_macros.extend([('HAS_GETHOSTBYNAME_R', None),
('HAS_GETHOSTBYADDR_R', None)])
ext_modules = [
Extension(
"enet",
extra_compile_args=["-O3"],
sources=source_files,
include_dirs=["enet/include/"],
define_macros=define_macros,
libraries=libraries,
library_dirs=["enet/"])
]
setup(
name='pyenet',
# packages=['enet'],
description='A python wrapper for the ENet library',
long_description=long_description,
url='https://github.com/piqueserver/pyenet/',
maintainer='Andrew Resch, Piqueserver team',
maintainer_email='[email protected]',
version=package_version,
cmdclass={'build_ext': build_ext},
ext_modules=ext_modules,
setup_requires=['Cython>=0,<1'],
install_requires=['Cython>=0,<1'],
)