-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·63 lines (53 loc) · 1.99 KB
/
setup.py
File metadata and controls
executable file
·63 lines (53 loc) · 1.99 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
#!/usr/bin/env python
import sys
import os
import traceback
from os.path import abspath, basename
from pipes import quote
try:
from setuptools import Extension, setup
except ImportError:
from distutils.core import Extension, setup
from distutils.command import build_ext
def system(cmd):
if os.system(cmd):
sys.exit('%r failed' % cmd)
class my_build_ext(build_ext.build_ext):
def build_extension(self, ext):
system('cd .. && make libgevent.a')
system('make gevent2.c')
result = build_ext.build_ext.build_extension(self, ext)
try:
fullname = self.get_ext_fullname(ext.name)
modpath = fullname.split('.')
filename = self.get_ext_filename(ext.name)
filename = os.path.split(filename)[-1]
if not self.inplace:
filename = os.path.join(*modpath[:-1] + [filename])
path_to_build_core_so = abspath(os.path.join(self.build_lib, filename))
path_to_core_so = abspath(basename(path_to_build_core_so))
if path_to_build_core_so != path_to_core_so:
cmd = 'cp %s %s' % (quote(path_to_build_core_so), quote(path_to_core_so))
#print cmd
os.system(cmd)
except Exception:
traceback.print_exc()
return result
EXT = Extension(name='gevent2',
sources=['gevent2.c'],
include_dirs=['..', '../libuv/include'],
libraries=['rt'],
extra_objects=['../libgevent.a', '../libuv/libuv.a']
)
if __name__ == '__main__':
setup(
name='gevent',
version='2.0dev',
author='Denis Bilenko',
author_email='denis.bilenko@gmail.com',
ext_modules=[EXT],
cmdclass={'build_ext': my_build_ext},
classifiers=[
"Topic :: Software Development :: Libraries :: Python Modules",
"Intended Audience :: Developers",
"Development Status :: 2 - Pre-Alpha"])