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
b01dcaf3
Commit
b01dcaf3
authored
Jun 10, 2020
by
Jason Madden
Committed by
GitHub
Jun 10, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1642 from gevent/issue1641
Make selectors2 truly optional on Py2 with dnspython
parents
bf4e5d87
95b03f11
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
9 deletions
+39
-9
.travis.yml
.travis.yml
+6
-3
docs/changes/issue1641.bugfix
docs/changes/issue1641.bugfix
+2
-0
scripts/releases/make-manylinux
scripts/releases/make-manylinux
+7
-1
src/gevent/_patcher.py
src/gevent/_patcher.py
+24
-5
No files found.
.travis.yml
View file @
b01dcaf3
...
...
@@ -13,7 +13,10 @@ os:
-
linux
-
osx
osx_image
:
xcode11.4
addons
:
homebrew
:
packages
:
-
ccache
env
:
global
:
...
...
@@ -95,7 +98,6 @@ before_install:
-
echo Running in stage $TRAVIS_BUILD_STAGE_NAME
-
|
if [[ "$TRAVIS_OS_NAME" == "osx" && "$TRAVIS_BUILD_STAGE_NAME" != "test" ]]; then
brew install ccache
export PATH="/usr/local/opt/ccache/libexec:$PATH"
export CFLAGS="$CFLAGS -Wno-parentheses-equality"
fi
...
...
@@ -313,7 +315,8 @@ jobs:
# Run dnspython with coverage enabled, it's implemented in python whereas ares is C.
# PyPy is supported.
-
&test-dnspython-jobs
script
:
GEVENT_RESOLVER=dnspython python -mgevent.tests --coverage --ignore tests_that_dont_use_resolver.txt
script
:
-
GEVENT_RESOLVER=dnspython python -mgevent.tests --coverage --ignore tests_that_dont_use_resolver.txt
name
:
dnspython resolver (Python 2.7)
# Now test the alternate backends, starting with libuv-cffi, which should be present everywhere
-
&test-libuv-jobs
...
...
docs/changes/issue1641.bugfix
0 → 100644
View file @
b01dcaf3
On Python 2, the dnspython resolver can be used without having
selectors2 installed. Previously, an ImportError would be raised.
scripts/releases/make-manylinux
View file @
b01dcaf3
...
...
@@ -40,9 +40,15 @@ if [ -d /gevent -a -d /opt/python ]; then
# Running inside docker
# Set a cache directory for pip. This was
# mounted to be the same as it is outside docker
# mounted to be the same as it is outside docker so it
# can be persisted.
# XXX: This works for macOS, where everything bind-mounted
# is seen as owned by root in the container. But when the host is Linux
# the actual UIDs come through to the container, triggering
# pip to disable the cache when it detects that the owner doesn't match.
export
XDG_CACHE_HOME
=
"/cache"
ls
-ld
/cache
ls
-ld
/cache/pip
yum
-y
install
libffi-devel ccache
# On Fedora Rawhide (F33)
# yum install python39 python3-devel gcc kernel-devel kernel-headers make diffutils file
...
...
src/gevent/_patcher.py
View file @
b01dcaf3
...
...
@@ -38,8 +38,31 @@ MAPPING = {
'gevent.contextvars'
:
'contextvars'
,
}
OPTIONAL_STDLIB_MODULES
=
frozenset
()
if
PY3
else
frozenset
([
'selectors2'
,
])
_PATCH_PREFIX
=
'__g_patched_module_'
def
_collect_stdlib_gevent_modules
():
"""
Return a map from standard library name to
imported gevent module that provides the same API.
Optional modules are skipped if they cannot be imported.
"""
result
=
{}
for
gevent_name
,
stdlib_name
in
iteritems
(
MAPPING
):
try
:
result
[
stdlib_name
]
=
importlib
.
import_module
(
gevent_name
)
except
ImportError
:
if
stdlib_name
in
OPTIONAL_STDLIB_MODULES
:
continue
raise
return
result
class
_SysModulesPatcher
(
object
):
def
__init__
(
self
,
importing
,
extra_all
=
lambda
mod_name
:
()):
...
...
@@ -49,11 +72,7 @@ class _SysModulesPatcher(object):
# green modules, replacing regularly imported modules.
# This begins as the gevent list of modules, and
# then gets extended with green things from the tree we import.
self
.
_green_modules
=
{
stdlib_name
:
importlib
.
import_module
(
gevent_name
)
for
gevent_name
,
stdlib_name
in
iteritems
(
MAPPING
)
}
self
.
_green_modules
=
_collect_stdlib_gevent_modules
()
## Transient, reset each time we're called.
# The set of things imported before we began.
...
...
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