Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
487f797d
Commit
487f797d
authored
Apr 10, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add "cython" command to setup.py: python setup.py cython
parent
df7f503e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
35 deletions
+39
-35
setup.py
setup.py
+39
-35
No files found.
setup.py
View file @
487f797d
...
...
@@ -70,6 +70,16 @@ def system(command):
return
os
.
system
(
command
)
def
run_cython
(
cython_command
=
'cython'
):
if
has_changed
(
'gevent/core.pyx'
,
'gevent/core_.pyx'
,
'gevent/libev.pxd'
):
system
(
'm4 gevent/core_.pyx > core.pyx && mv core.pyx gevent/'
)
if
has_changed
(
cython_output
,
'gevent/*.p*x*'
,
'gevent/*.h'
,
'gevent/*.c'
,
'libev/*.c'
,
'c-ares/*.c'
):
if
0
==
system
(
'%s gevent/core.pyx -o core.c && mv core.* gevent/'
%
(
cython_command
,
)):
data
=
open
(
cython_output
).
read
()
data
=
data
.
replace
(
'
\
n
\
n
#endif /* Py_PYTHON_H */'
,
'
\
n
#include "callbacks.c"
\
n
#endif /* Py_PYTHON_H */'
)
open
(
cython_output
,
'w'
).
write
(
data
)
class
my_build_ext
(
build_ext
.
build_ext
):
user_options
=
(
build_ext
.
build_ext
.
user_options
+
[(
"cython="
,
None
,
"path to the cython executable"
)])
...
...
@@ -78,22 +88,13 @@ class my_build_ext(build_ext.build_ext):
build_ext
.
build_ext
.
initialize_options
(
self
)
self
.
cython
=
"cython"
def
compile_cython
(
self
):
if
has_changed
(
'gevent/core.pyx'
,
'gevent/core_.pyx'
,
'gevent/libev.pxd'
):
system
(
'm4 gevent/core_.pyx > core.pyx && mv core.pyx gevent/'
)
if
has_changed
(
cython_output
,
'gevent/*.p*x*'
,
'gevent/*.h'
,
'gevent/*.c'
,
'libev/*.c'
,
'c-ares/*.c'
):
if
0
==
system
(
'%s gevent/core.pyx -o core.c && mv core.* gevent/'
%
(
self
.
cython
,
)):
data
=
open
(
cython_output
).
read
()
data
=
data
.
replace
(
'
\
n
\
n
#endif /* Py_PYTHON_H */'
,
'
\
n
#include "callbacks.c"
\
n
#endif /* Py_PYTHON_H */'
)
open
(
cython_output
,
'w'
).
write
(
data
)
def
configure_cares
(
self
):
if
sys
.
platform
!=
'win32'
and
not
os
.
path
.
exists
(
'c-ares/ares_config.h'
):
os
.
system
(
'cd c-ares && %s'
%
cares_configure_command
)
def
build_extension
(
self
,
ext
):
if
self
.
cython
:
self
.
compile_cython
(
)
run_cython
(
self
.
cython
)
if
cares_embed
:
self
.
configure_cares
()
try
:
...
...
@@ -142,28 +143,31 @@ def read(name):
if
__name__
==
'__main__'
:
setup
(
name
=
'gevent'
,
version
=
__version__
,
description
=
'Coroutine-based network library'
,
long_description
=
read
(
'README.rst'
),
author
=
'Denis Bilenko'
,
author_email
=
'denis.bilenko@gmail.com'
,
url
=
'http://www.gevent.org/'
,
packages
=
[
'gevent'
],
ext_modules
=
[
gevent_core
],
cmdclass
=
{
'build_ext'
:
my_build_ext
},
install_requires
=
[
'greenlet'
],
classifiers
=
[
"License :: OSI Approved :: MIT License"
,
"Programming Language :: Python :: 2.4"
,
"Programming Language :: Python :: 2.5"
,
"Programming Language :: Python :: 2.6"
,
"Programming Language :: Python :: 2.7"
,
"Operating System :: MacOS :: MacOS X"
,
"Operating System :: POSIX"
,
"Operating System :: Microsoft :: Windows"
,
"Topic :: Internet"
,
"Topic :: Software Development :: Libraries :: Python Modules"
,
"Intended Audience :: Developers"
,
"Development Status :: 4 - Beta"
])
if
sys
.
argv
[
1
:]
==
[
'cython'
]:
run_cython
()
else
:
setup
(
name
=
'gevent'
,
version
=
__version__
,
description
=
'Coroutine-based network library'
,
long_description
=
read
(
'README.rst'
),
author
=
'Denis Bilenko'
,
author_email
=
'denis.bilenko@gmail.com'
,
url
=
'http://www.gevent.org/'
,
packages
=
[
'gevent'
],
ext_modules
=
[
gevent_core
],
cmdclass
=
{
'build_ext'
:
my_build_ext
},
install_requires
=
[
'greenlet'
],
classifiers
=
[
"License :: OSI Approved :: MIT License"
,
"Programming Language :: Python :: 2.4"
,
"Programming Language :: Python :: 2.5"
,
"Programming Language :: Python :: 2.6"
,
"Programming Language :: Python :: 2.7"
,
"Operating System :: MacOS :: MacOS X"
,
"Operating System :: POSIX"
,
"Operating System :: Microsoft :: Windows"
,
"Topic :: Internet"
,
"Topic :: Software Development :: Libraries :: Python Modules"
,
"Intended Audience :: Developers"
,
"Development Status :: 4 - Beta"
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment