Closed penguinpee closed 3 months ago
@penguinpee it's likely that you misapplied that patch and lost yield
along the way. A missing yield
under @contextmanager
is the only reasonable explanation. I'm sure if you git diff
your thing and look into it carefully, you'll spot what's gone wrong.
Hmm. I'm stupefied. I just ran another build and it works. I can not recall what I did differently two weeks ago. Anyway, it wasn't the patch applied. That looks sane (except for the added @contextmanager
):
diff --git a/packaging/pep517_backend/_backend.py b/packaging/pep517_backend/_backend.py
index 9a28ace..e09fd06 100644
--- a/packaging/pep517_backend/_backend.py
+++ b/packaging/pep517_backend/_backend.py
@@ -194,12 +194,22 @@ def patched_dist_get_long_description():
_DistutilsDistributionMetadata.get_long_description = _orig_func
+@contextmanager
@contextmanager
def _in_temporary_directory(src_dir: Path) -> t.Iterator[None]:
with TemporaryDirectory(prefix='.tmp-yarl-pep517-') as tmp_dir:
with chdir_cm(tmp_dir):
tmp_src_dir = Path(tmp_dir) / 'src'
- copytree(src_dir, tmp_src_dir, symlinks=True)
+ def _ignore(d, _):
+ """
+ Prevent temporary directory to be copied into self
+ recursively forever.
+ Fixes https://github.com/aio-libs/yarl/issues/992
+ """
+ if Path(d) == tmp_src_dir.parent:
+ return [tmp_src_dir.name]
+ return []
+ copytree(src_dir, tmp_src_dir, symlinks=True, ignore=_ignore)
os.chdir(tmp_src_dir)
yield
Well, I can proceed. I won't wack my :brain: about it.
That looks sane (except for the added
@contextmanager
):
Yep, double @contextmanager
would cause that.
I see. That would explain it. My :brain: woke up and I know now why it suddenly worked. I changed the build config to build a pure Python package just as a trial.
I had to revert all that. But with the fixed patch, it now builds with C extensions as well. All good! :tada:
Describe the bug
While preparing to update
yarl
for Fedora to 1.9.4, the build failed withTypeError: '_GeneratorContextManager' object is not an iterator
.First, I encountered the infinite recursion described in #992. I applied the suggested fix from https://github.com/aio-libs/yarl/issues/992#issuecomment-1934720352 as a patch. After that I ran into the TypeError.
The issue is reproducible locally in a venv.
To Reproduce
v1.9.4
and apply patch from https://github.com/aio-libs/yarl/issues/992#issuecomment-1934720352pip wheel --wheel-dir pyproject-wheeldir --no-deps --use-pep517 --no-build-isolation --disable-pip-version-check --no-clean --verbose .
(That's how the wheel is build in our build environment)Expected behavior
The wheel is build.
Logs/tracebacks
Python Version
multidict Version
yarl Version
OS
NAME="Fedora Linux" VERSION="39 (Thirty Nine)" ID=fedora VERSION_ID=39 VERSION_CODENAME="" PLATFORM_ID="platform:f39" PRETTY_NAME="Fedora Linux 39 (Thirty Nine)" ANSI_COLOR="0;38;2;60;110;180" LOGO=fedora-logo-icon CPE_NAME="cpe:/o:fedoraproject:fedora:39" DEFAULT_HOSTNAME="fedora" HOME_URL="https://fedoraproject.org/" DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f39/system-administrators-guide/" SUPPORT_URL="https://ask.fedoraproject.org/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT_VERSION=39 REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT_VERSION=39 SUPPORT_END=2024-11-12
Additional context
Build dependencies are coming from Fedora repos. So, versions may differ to what pip would install. Above information is with regards to the local reproducer.
Notably, when passing
-C pure-python=1
to pip, the wheel is built successfully. But since we want the C extensions, that's not a way out.I also saw #1001. But this looks different.
Code of Conduct