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
31ff5ccc
Commit
31ff5ccc
authored
May 01, 2019
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get non-embedded libuv working on POSIX at least.
Fixes #1395
parent
1698e9a7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
37 deletions
+57
-37
.travis.yml
.travis.yml
+14
-9
CHANGES.rst
CHANGES.rst
+3
-0
_setuplibev.py
_setuplibev.py
+0
-1
_setuputils.py
_setuputils.py
+0
-1
docs/installing_from_source.rst
docs/installing_from_source.rst
+1
-7
setup.py
setup.py
+0
-10
src/gevent/libev/_corecffi_build.py
src/gevent/libev/_corecffi_build.py
+6
-2
src/gevent/libuv/_corecffi_build.py
src/gevent/libuv/_corecffi_build.py
+29
-7
src/gevent/libuv/_corecffi_cdef.c
src/gevent/libuv/_corecffi_cdef.c
+4
-0
No files found.
.travis.yml
View file @
31ff5ccc
...
...
@@ -145,10 +145,14 @@ jobs:
-
rm -rf $BUILD_LIBS/share/man/
-
ls -l $BUILD_LIBS $BUILD_LIBS/lib $BUILD_LIBS/include
-
pip install --no-build-isolation .[test]
-
objdump -p $G_SITE/gevent/libev/*so
# Test that we're actually linking
# to the .so file.
-
objdump -p $G_SITE/gevent/libev/_corecffi*so | grep "NEEDED.*libev.so"
-
objdump -p $G_SITE/gevent/libuv/_corecffi*so | grep "NEEDED.*libuv.so"
script
:
# Verify that we got non-embedded builds
-
python -c 'import gevent.libev.corecffi as CF; assert not CF.LIBEV_EMBED'
-
python -c 'import gevent.libuv.loop as CF; assert not CF.libuv.LIBUV_EMBED'
# Ok, now we switch to the test stage. These are all in addition
# to the jobs created by the matrix (and should override the `script` command).
...
...
@@ -244,17 +248,18 @@ jobs:
# 2.7, no-embed. Run the tests that exercise the libraries we
# linked to.
# XXX: The CFFI backends, as exercised by test-lib[eu]v-jobs
# don't really support this!
-
<<
:
*test-ares-jobs
# This job exercises both the non-embedded ares resolver
# and the non-embedded Cython libev loop.
env
:
TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0
name
:
ares27-noembed
# - <<: *test-libuv-jobs
# env: TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0
# name: libuv27-noembed
# - <<: *test-libev-jobs
# env: TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0
# name: libev27-noembed
# These exercise the CFFI versions.
-
<<
:
*test-libuv-jobs
env
:
TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0
name
:
libuv27-noembed
-
<<
:
*test-libev-jobs
env
:
TRAVIS_PYTHON_VERSION=2.7 GEVENTSETUP_EMBED=0
name
:
libev27-noembed
# PyPy 2.7
-
<<
:
*test-dnspython-jobs
...
...
CHANGES.rst
View file @
31ff5ccc
...
...
@@ -90,6 +90,9 @@
variables. Instead, use ``GEVENTSETUP_EMBED`` and
``GEVENTSETUP_EMBED_LIBEV``. See :issue:`1402`.
- The CFFI backends now respect the embed build-time setting. This allows
building the libuv backend without embedding libuv (except on Windows).
- Support test resources. This allows disabling tests that use the
network. See :ref:`limiting-test-resource-usage` for more.
...
...
_setuplibev.py
View file @
31ff5ccc
...
...
@@ -22,7 +22,6 @@ from _setuputils import DEFINE_MACROS
from
_setuputils
import
glob_many
from
_setuputils
import
dep_abspath
from
_setuputils
import
should_embed
from
_setuputils
import
cythonize1
LIBEV_EMBED
=
should_embed
(
'libev'
)
...
...
_setuputils.py
View file @
31ff5ccc
...
...
@@ -87,7 +87,6 @@ def _bool_from_environ(key):
raise
ValueError
(
'Environment variable %r has invalid value %r. '
'Please set it to 1, 0 or an empty string'
%
(
key
,
value
))
IGNORE_CFFI
=
_bool_from_environ
(
"GEVENTSETUP_NO_CFFI_BUILD"
)
def
_check_embed
(
key
,
defkey
,
path
=
None
,
warn
=
False
):
"""
...
...
docs/installing_from_source.rst
View file @
31ff5ccc
...
...
@@ -107,11 +107,6 @@ yes/no.
In general, setting ``CPPFLAGS`` is more general and can contain
other macros recognized by libev.
``GEVENTSETUP_NO_CFFI_BUILD``
A boolean; when set to true, this disables all attempts at building
the CFFI modules. *This disables libuv.* (TODO: verify that.)
Ignored on PyPy and ignored on Windows.
Embedding Libraries
-------------------
...
...
@@ -124,8 +119,7 @@ embedding, especially in the case of libev, can be more efficient as
features not needed by gevent can be disabled, resulting in smaller or
faster libraries or runtimes.
However, this can be disabled (TODO: verify how this interacts with
CFFI; see NO_CFFI_BUILD), either for all libraries at once or for
However, this can be disabled, either for all libraries at once or for
individual libraries.
When embedding a library is disabled, the library must already be
...
...
setup.py
View file @
31ff5ccc
...
...
@@ -17,7 +17,6 @@ from _setuputils import read
from
_setuputils
import
read_version
from
_setuputils
import
system
from
_setuputils
import
PYPY
,
WIN
from
_setuputils
import
IGNORE_CFFI
from
_setuputils
import
ConfiguringBuildExt
from
_setuputils
import
GeventClean
from
_setuputils
import
BuildFailed
...
...
@@ -285,15 +284,6 @@ for mod in _to_cythonize:
del
_to_cythonize
if
IGNORE_CFFI
and
not
PYPY
and
not
WIN
:
# Allow distributors to turn off CFFI builds
# even if it's available, because CFFI always embeds
# our copy of libev/libuv and they may not want that.
# Not allowed on PyPy and not allowed on Windows, because those
# backends are required there.
# TODO: CONFIRM if this is still the case.
del
cffi_modules
[:]
## Extras
EXTRA_DNSPYTHON
=
[
...
...
src/gevent/libev/_corecffi_build.py
View file @
31ff5ccc
...
...
@@ -12,8 +12,12 @@ import os
import
os.path
# pylint:disable=no-name-in-module
from
cffi
import
FFI
# We must be run from the directory containing setup.py.
import
_setuplibev
sys
.
path
.
append
(
"."
)
try
:
import
_setuplibev
except
ImportError
:
print
(
"This file must be imported with setup.py in the current working dir."
)
raise
thisdir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
setup_dir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
thisdir
,
'..'
,
'..'
,
'..'
))
...
...
src/gevent/libuv/_corecffi_build.py
View file @
31ff5ccc
...
...
@@ -11,16 +11,29 @@ import sys
import
os
import
os.path
# pylint:disable=no-name-in-module
from
cffi
import
FFI
sys
.
path
.
append
(
"."
)
try
:
import
_setuputils
except
ImportError
:
print
(
"This file must be imported with setup.py in the current working dir."
)
raise
__all__
=
[]
WIN
=
sys
.
platform
.
startswith
(
'win32'
)
LIBUV_EMBED
=
_setuputils
.
should_embed
(
'libuv'
)
print
(
"Embedding libuv?"
,
LIBUV_EMBED
)
from
cffi
import
FFI
ffi
=
FFI
()
thisdir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
setup_py_dir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
thisdir
,
'..'
,
'..'
,
'..'
))
libuv_dir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
setup_py_dir
,
'deps'
,
'libuv'
))
def
read_source
(
name
):
with
open
(
os
.
path
.
join
(
thisdir
,
name
),
'r'
)
as
f
:
return
f
.
read
()
...
...
@@ -49,12 +62,9 @@ _void_pointer_as_integer = 'intptr_t'
_cdef
=
_cdef
.
replace
(
"GEVENT_UV_OS_SOCK_T"
,
'int'
if
not
WIN
else
_void_pointer_as_integer
)
setup_py_dir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
thisdir
,
'..'
,
'..'
,
'..'
))
libuv_dir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
setup_py_dir
,
'deps'
,
'libuv'
))
LIBUV_INCLUDE_DIRS
=
[
thisdir
,
# libev_vfd.h
os
.
path
.
join
(
libuv_dir
,
'include'
),
os
.
path
.
join
(
libuv_dir
,
'src'
),
]
...
...
@@ -192,7 +202,9 @@ elif sys.platform.startswith('sunos'):
]
LIBUV_MACROS
=
[]
LIBUV_MACROS
=
[
(
'LIBUV_EMBED'
,
int
(
LIBUV_EMBED
)),
]
def
_define_macro
(
name
,
value
):
LIBUV_MACROS
.
append
((
name
,
value
))
...
...
@@ -239,6 +251,11 @@ elif WIN:
_add_library
(
'userenv'
)
_add_library
(
'ws2_32'
)
if
not
LIBUV_EMBED
:
del
LIBUV_SOURCES
[:]
del
LIBUV_INCLUDE_DIRS
[:]
_add_library
(
'uv'
)
ffi
.
cdef
(
_cdef
)
ffi
.
set_source
(
'gevent.libuv._corecffi'
,
_source
,
...
...
@@ -249,4 +266,9 @@ ffi.set_source('gevent.libuv._corecffi',
define_macros
=
list
(
LIBUV_MACROS
))
if
__name__
==
'__main__'
:
ffi
.
compile
()
# See notes in libev/_corecffi_build.py for how to test this.
#
# Other than the obvious directory changes, the changes are:
#
# CPPFLAGS=-Ideps/libuv/include/
ffi
.
compile
(
verbose
=
True
)
src/gevent/libuv/_corecffi_cdef.c
View file @
31ff5ccc
/* access whether we built embedded or not */
#define LIBUV_EMBED ...
/* markers for the CFFI parser. Replaced when the string is read. */
#define GEVENT_STRUCT_DONE int
#define GEVENT_ST_NLINK_T int
...
...
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