This repository was archived by the owner on May 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
81 lines (66 loc) · 1.82 KB
/
setup.py
File metadata and controls
81 lines (66 loc) · 1.82 KB
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
78
79
80
81
from distutils.core import setup, Extension
from distutils.ccompiler import new_compiler
import select
import sys
try:
import setuptools
except ImportError:
pass
extensions = []
def find_epoll():
print 'looking for epoll ..',
if hasattr(select, 'epoll'):
print 'using select.epoll'
else:
print 'using extension'
extensions.append(Extension('net/async/_epoll',
sources = ['src/async/_epoll.c'],
))
def find_kqueue():
# kqueue support for Python before 2.6
print 'looking for kqueue ..',
if hasattr(select, 'kqueue'):
print 'using select.kqueue'
else:
print 'using extension'
extensions.append(Extension('net/async/_kqueue',
sources = ['src/async/_kqueue.c'],
))
print 'looking for platform ..',
if sys.platform.startswith('linux'):
print 'Linux'
# depends on AF_AX25 and libax25
compiler = new_compiler()
lib_dirs = ['/lib', '/lib64', '/usr/lib', '/usr/lib64', '/usr/local/lib',
'/usr/local/lib64']
print 'looking for libax25 ..',
lib_ax25 = compiler.find_library_file(lib_dirs, 'ax25')
if lib_ax25:
print lib_ax25
extensions.append(Extension('net/family/_ax25',
sources = ['src/family/_ax25.c'],
libraries = ['ax25', 'ax25io'],
))
else:
print 'no'
# Linux uses epoll interface
find_epoll()
elif sys.platform == 'darwin':
print 'darwin'
# Darwin uses kqueue interface
find_kqueue()
elif sys.platform == 'freebsd':
print 'freebsd'
# FreeBSD uses kqueue interface
find_kqueue()
else:
print 'unsupported (%s)' % (sys.platform,)
setup(name = 'net',
version = '0.0.1',
ext_modules = extensions,
packages = [
'net',
'net.async',
'net.family',
]
)