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
958d9b6c
Commit
958d9b6c
authored
May 08, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup.py: replace 'gevent_embed' with EMBED, LIBEV_EMBED, CARES_EMBED
parent
4aea9eb7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
8 deletions
+29
-8
setup.py
setup.py
+29
-8
No files found.
setup.py
View file @
958d9b6c
...
@@ -21,9 +21,30 @@ ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError, IOErro
...
@@ -21,9 +21,30 @@ ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError, IOErro
__version__
=
re
.
search
(
"__version__
\
s*=
\
s*'(.*)'"
,
open
(
'gevent/__init__.py'
).
read
(),
re
.
M
).
group
(
1
)
__version__
=
re
.
search
(
"__version__
\
s*=
\
s*'(.*)'"
,
open
(
'gevent/__init__.py'
).
read
(),
re
.
M
).
group
(
1
)
assert
__version__
assert
__version__
embed
=
os
.
environ
.
get
(
"gevent_embed"
,
"yes"
).
lower
().
strip
()
not
in
(
"0"
,
"no"
,
"off"
)
libev_embed
=
embed
and
os
.
path
.
exists
(
'libev'
)
def
parse_environ
(
key
):
ares_embed
=
embed
and
os
.
path
.
exists
(
'c-ares'
)
value
=
os
.
environ
.
get
(
key
)
if
not
value
:
return
value
=
value
.
lower
().
strip
()
if
value
in
(
'1'
,
'true'
,
'on'
,
'yes'
):
return
True
elif
value
in
(
'0'
,
'false'
,
'off'
,
'no'
):
return
False
raise
ValueError
(
'Environment variable %r has invalid value %r. Please set it to 1, 0 or an empty string'
%
(
key
,
value
))
def
get_config_value
(
key
,
defkey
,
path
):
value
=
parse_environ
(
key
)
if
value
is
None
:
value
=
parse_environ
(
defkey
)
if
value
is
None
:
return
os
.
path
.
exists
(
path
)
LIBEV_EMBED
=
get_config_value
(
'LIBEV_EMBED'
,
'EMBED'
,
'libev'
)
CARES_EMBED
=
get_config_value
(
'CARES_EMBED'
,
'EMBED'
,
'c-ares'
)
define_macros
=
[]
define_macros
=
[]
libraries
=
[]
libraries
=
[]
libev_configure_command
=
[
"/bin/sh"
,
abspath
(
'libev/configure'
),
'> configure-output.txt'
]
libev_configure_command
=
[
"/bin/sh"
,
abspath
(
'libev/configure'
),
'> configure-output.txt'
]
...
@@ -45,7 +66,7 @@ def expand(*lst):
...
@@ -45,7 +66,7 @@ def expand(*lst):
CORE
=
Extension
(
name
=
'gevent.core'
,
CORE
=
Extension
(
name
=
'gevent.core'
,
sources
=
[
'gevent/gevent.core.c'
],
sources
=
[
'gevent/gevent.core.c'
],
include_dirs
=
[
'libev'
]
if
libev_embed
else
[],
include_dirs
=
[
'libev'
]
if
LIBEV_EMBED
else
[],
libraries
=
libraries
,
libraries
=
libraries
,
define_macros
=
define_macros
,
define_macros
=
define_macros
,
depends
=
expand
(
'gevent/callbacks.*'
,
'gevent/stathelper.c'
,
'gevent/libev*.h'
,
'libev/*.*'
))
depends
=
expand
(
'gevent/callbacks.*'
,
'gevent/stathelper.c'
,
'gevent/libev*.h'
,
'libev/*.*'
))
...
@@ -53,7 +74,7 @@ CORE = Extension(name='gevent.core',
...
@@ -53,7 +74,7 @@ CORE = Extension(name='gevent.core',
ARES
=
Extension
(
name
=
'gevent.ares'
,
ARES
=
Extension
(
name
=
'gevent.ares'
,
sources
=
[
'gevent/gevent.ares.c'
],
sources
=
[
'gevent/gevent.ares.c'
],
include_dirs
=
[
'c-ares'
]
if
ares_embed
else
[],
include_dirs
=
[
'c-ares'
]
if
CARES_EMBED
else
[],
libraries
=
libraries
,
libraries
=
libraries
,
define_macros
=
define_macros
,
define_macros
=
define_macros
,
depends
=
expand
(
'gevent/dnshelper.c'
,
'gevent/cares_*.*'
))
depends
=
expand
(
'gevent/dnshelper.c'
,
'gevent/cares_*.*'
))
...
@@ -140,7 +161,7 @@ def configure_ares(bext, ext):
...
@@ -140,7 +161,7 @@ def configure_ares(bext, ext):
os
.
chdir
(
cwd
)
os
.
chdir
(
cwd
)
if
libev_embed
:
if
LIBEV_EMBED
:
CORE
.
define_macros
+=
[(
'LIBEV_EMBED'
,
'1'
),
CORE
.
define_macros
+=
[(
'LIBEV_EMBED'
,
'1'
),
(
'EV_COMMON'
,
''
),
# we don't use void* data
(
'EV_COMMON'
,
''
),
# we don't use void* data
# libev watchers that we don't use currently:
# libev watchers that we don't use currently:
...
@@ -155,7 +176,7 @@ else:
...
@@ -155,7 +176,7 @@ else:
CORE
.
libraries
.
append
(
'ev'
)
CORE
.
libraries
.
append
(
'ev'
)
if
ares_embed
:
if
CARES_EMBED
:
ARES
.
sources
+=
expand
(
'c-ares/*.c'
)
ARES
.
sources
+=
expand
(
'c-ares/*.c'
)
ARES
.
configure
=
configure_ares
ARES
.
configure
=
configure_ares
if
sys
.
platform
==
'win32'
:
if
sys
.
platform
==
'win32'
:
...
@@ -165,7 +186,7 @@ if ares_embed:
...
@@ -165,7 +186,7 @@ if ares_embed:
ARES
.
define_macros
+=
[(
'HAVE_CONFIG_H'
,
''
)]
ARES
.
define_macros
+=
[(
'HAVE_CONFIG_H'
,
''
)]
if
sys
.
platform
!=
'darwin'
:
if
sys
.
platform
!=
'darwin'
:
ARES
.
libraries
+=
[
'rt'
]
ARES
.
libraries
+=
[
'rt'
]
ARES
.
define_macros
+=
[(
'CARES_EMBED'
,
''
)]
ARES
.
define_macros
+=
[(
'CARES_EMBED'
,
'
1
'
)]
else
:
else
:
ARES
.
libraries
.
append
(
'cares'
)
ARES
.
libraries
.
append
(
'cares'
)
ARES
.
define_macros
+=
[(
'HAVE_NETDB_H'
,
''
)]
ARES
.
define_macros
+=
[(
'HAVE_NETDB_H'
,
''
)]
...
...
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