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
232bc505
Commit
232bc505
authored
Apr 11, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 'cython' command to setup.py
parent
397e7b77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
47 deletions
+51
-47
setup.py
setup.py
+51
-47
No files found.
setup.py
View file @
232bc505
...
...
@@ -40,6 +40,28 @@ sources = ['gevent/core.c']
libraries
=
[]
def
run_cython
(
cython_command
=
'cython'
):
sources
=
glob
.
glob
(
'gevent/*.pyx'
)
+
glob
.
glob
(
'gevent/*.pxi'
)
if
not
sources
:
if
not
os
.
path
.
exists
(
'gevent/core.c'
):
print
>>
sys
.
stderr
,
'Could not find gevent/core.c'
if
os
.
path
.
exists
(
'gevent/core.c'
):
core_c_mtime
=
os
.
stat
(
'gevent/core.c'
).
st_mtime
changed
=
[
filename
for
filename
in
sources
if
(
os
.
stat
(
filename
).
st_mtime
-
core_c_mtime
)
>
1
]
if
not
changed
:
return
print
>>
sys
.
stderr
,
'Running %s (changed: %s)'
%
(
cython_command
,
', '
.
join
(
changed
))
else
:
print
>>
sys
.
stderr
,
'Running %s'
%
cython_command
cython_result
=
os
.
system
(
'%s gevent/core.pyx'
%
cython_command
)
if
cython_result
:
if
os
.
system
(
'%s -V 2> %s'
%
(
cython_command
,
os
.
devnull
)):
# there's no cython in the system
print
>>
sys
.
stderr
,
'No cython found, cannot rebuild core.c'
return
sys
.
exit
(
1
)
class
my_build_ext
(
build_ext
.
build_ext
):
user_options
=
(
build_ext
.
build_ext
.
user_options
+
[(
"cython="
,
None
,
"path to the cython executable"
)])
...
...
@@ -48,31 +70,10 @@ class my_build_ext(build_ext.build_ext):
build_ext
.
build_ext
.
initialize_options
(
self
)
self
.
cython
=
"cython"
def
compile_cython
(
self
):
sources
=
glob
.
glob
(
'gevent/*.pyx'
)
+
glob
.
glob
(
'gevent/*.pxi'
)
if
not
sources
:
if
not
os
.
path
.
exists
(
'gevent/core.c'
):
print
>>
sys
.
stderr
,
'Could not find gevent/core.c'
if
os
.
path
.
exists
(
'gevent/core.c'
):
core_c_mtime
=
os
.
stat
(
'gevent/core.c'
).
st_mtime
changed
=
[
filename
for
filename
in
sources
if
(
os
.
stat
(
filename
).
st_mtime
-
core_c_mtime
)
>
1
]
if
not
changed
:
return
print
>>
sys
.
stderr
,
'Running %s (changed: %s)'
%
(
self
.
cython
,
', '
.
join
(
changed
))
else
:
print
>>
sys
.
stderr
,
'Running %s'
%
self
.
cython
cython_result
=
os
.
system
(
'%s gevent/core.pyx'
%
self
.
cython
)
if
cython_result
:
if
os
.
system
(
'%s -V 2> %s'
%
(
self
.
cython
,
os
.
devnull
)):
# there's no cython in the system
print
>>
sys
.
stderr
,
'No cython found, cannot rebuild core.c'
return
sys
.
exit
(
1
)
def
build_extension
(
self
,
ext
):
compile_libevent
(
self
)
if
self
.
cython
:
self
.
compile_cython
(
)
run_cython
(
self
.
cython
)
result
=
build_ext
.
build_ext
.
build_extension
(
self
,
ext
)
# hack: create a symlink from build/../core.so to gevent/core.so
# to prevent "ImportError: cannot import name core" failures
...
...
@@ -295,28 +296,31 @@ def read(name):
if
__name__
==
'__main__'
:
setup
(
name
=
'gevent'
,
version
=
__version__
,
description
=
'Python network library that uses greenlet and libevent for easy and scalable concurrency'
,
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
=
'Python network library that uses greenlet and libevent for easy and scalable concurrency'
,
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