Skip to content

Commit

Permalink
Merge branch 'main' into debt/remove-pkg-resources
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Feb 12, 2022
2 parents 740c3b1 + f38d139 commit 31850d4
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 60.8.1
current_version = 60.8.2
commit = True
tag = True

Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/ci-sage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Run Sage CI for Linux
## - continuous integration, by building and testing other software
## that depends on this project.
##
## It runs on every pull request and push of a tag to the GitHub repository.
## It runs on every push of a tag to the GitHub repository.
##
## The testing can be monitored in the "Actions" tab of the GitHub repository.
##
Expand All @@ -33,11 +33,7 @@ name: Run Sage CI for Linux
## Many copies of the second step are run in parallel for each of the tested
## systems/configurations.

#on: [push, pull_request]

on:
pull_request:
types: [opened, synchronize]
push:
tags:
- '*'
Expand Down
12 changes: 12 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
v60.8.2
-------


Misc
^^^^
* #3091: Make ``concurrent.futures`` import lazy in vendored ``more_itertools``
package to a avoid importing threading as a side effect (which caused
`gevent/gevent#1865 <https://github.com/gevent/gevent/issues/1865>`__).
-- by :user:`maciejp-ro`


v60.8.1
-------

Expand Down
7 changes: 0 additions & 7 deletions bootstrap.py

This file was deleted.

3 changes: 1 addition & 2 deletions pkg_resources/_vendor/more_itertools/more.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from collections import Counter, defaultdict, deque, abc
from collections.abc import Sequence
from concurrent.futures import ThreadPoolExecutor
from functools import partial, reduce, wraps
from heapq import merge, heapify, heapreplace, heappop
from itertools import (
Expand Down Expand Up @@ -3656,7 +3655,7 @@ def __init__(self, func, callback_kwd='callback', wait_seconds=0.1):
self._aborted = False
self._future = None
self._wait_seconds = wait_seconds
self._executor = ThreadPoolExecutor(max_workers=1)
self._executor = __import__("concurrent.futures").futures.ThreadPoolExecutor(max_workers=1)
self._iterator = self._reader()

def __enter__(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = setuptools
version = 60.8.1
version = 60.8.2
author = Python Packaging Authority
author_email = distutils-sig@python.org
description = Easily download, build, install, upgrade, and uninstall Python packages
Expand Down
3 changes: 1 addition & 2 deletions setuptools/_vendor/more_itertools/more.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from collections import Counter, defaultdict, deque, abc
from collections.abc import Sequence
from concurrent.futures import ThreadPoolExecutor
from functools import partial, reduce, wraps
from heapq import merge, heapify, heapreplace, heappop
from itertools import (
Expand Down Expand Up @@ -3454,7 +3453,7 @@ def __init__(self, func, callback_kwd='callback', wait_seconds=0.1):
self._aborted = False
self._future = None
self._wait_seconds = wait_seconds
self._executor = ThreadPoolExecutor(max_workers=1)
self._executor = __import__("concurrent.futures").futures.ThreadPoolExecutor(max_workers=1)
self._iterator = self._reader()

def __enter__(self):
Expand Down
17 changes: 17 additions & 0 deletions tools/vendored.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ def rewrite_importlib_metadata(pkg_files, new_root):
file.write_text(text)


def rewrite_more_itertools(pkg_files: Path):
"""
Defer import of concurrent.futures. Workaround for #3090.
"""
more_file = pkg_files.joinpath('more.py')
text = more_file.read_text()
text = re.sub(r'^.*concurrent.futures.*?\n', '', text, flags=re.MULTILINE)
text = re.sub(
'ThreadPoolExecutor',
'__import__("concurrent.futures").futures.ThreadPoolExecutor',
text,
)
more_file.write_text(text)


def clean(vendor):
"""
Remove all files out of the vendor directory except the meta
Expand Down Expand Up @@ -106,6 +121,7 @@ def update_pkg_resources():
rewrite_jaraco_text(vendor / 'jaraco/text', 'pkg_resources.extern')
rewrite_jaraco(vendor / 'jaraco', 'pkg_resources.extern')
rewrite_importlib_resources(vendor / 'importlib_resources', 'pkg_resources.extern')
rewrite_more_itertools(vendor / "more_itertools")


def update_setuptools():
Expand All @@ -116,6 +132,7 @@ def update_setuptools():
rewrite_jaraco(vendor / 'jaraco', 'setuptools.extern')
rewrite_importlib_resources(vendor / 'importlib_resources', 'setuptools.extern')
rewrite_importlib_metadata(vendor / 'importlib_metadata', 'setuptools.extern')
rewrite_more_itertools(vendor / "more_itertools")


__name__ == '__main__' and update_vendored()

0 comments on commit 31850d4

Please sign in to comment.