summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorChristoph Egger <christoph@debian.org>2017-05-28 14:30:29 +0200
committerChristoph Egger <christoph@debian.org>2017-05-28 14:30:29 +0200
commit9f30a9497bb1e812acfdf1c98e3b5cf35ddd8e39 (patch)
tree1c84647324d5e1ddf43a46b9e3630849ddd9b334 /setup.py
parent122bb8ba0b15478112fec10ebb3c0abf546d7fee (diff)
New upstream version 0.0~vcs.2017.05.26.git
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..95d55e8
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,47 @@
+from distutils.core import setup
+from distutils.extension import Extension
+from Cython.Distutils import build_ext
+
+import glob
+import sys
+
+source_files = ["enet.pyx"]
+
+_enet_files = glob.glob("enet/*.c")
+
+if not _enet_files:
+ print("You need to download and extract the enet 1.3 source to enet/")
+ print("Download the source from: http://enet.bespin.org/SourceDistro.html")
+ print("See the README for more instructions")
+ sys.exit(1)
+
+source_files.extend(_enet_files)
+
+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(['ws2_32', 'Winmm'])
+
+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)]
+
+setup(
+ name = 'enet',
+ cmdclass = {'build_ext': build_ext},
+ ext_modules = ext_modules
+)