-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrated config to pyproject.toml. #4310
Conversation
It's not immediately obvious to me why this change breaks the build. |
The tests are failing with the "Pre-build distributions for test" part of the CI environment with the following traceback while attempting to invoke the PEP 517
|
I'm unable to replicate the failure in a clean docker image:
|
Aah. The failures are in the |
Unfortunately, I still can't replicate the issue with |
Even running the action using |
As a shot in the dark, I tried setting the SETUPTOOLS_USE_DISTUTILS explicitly in the script and that does replicate the failure when using the diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ec2e567a1..cdc66d2bb 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -96,7 +96,7 @@ jobs:
run: |
rm -rf dist
# workaround for pypa/setuptools#4333
- pipx run --pip-args 'pyproject-hooks!=1.1' build
+ env SETUPTOOLS_USE_DISTUTILS=stdlib pipx run --pip-args 'pyproject-hooks!=1.1' build
echo "PRE_BUILT_SETUPTOOLS_SDIST=$(ls dist/*.tar.gz)" >> $GITHUB_ENV
echo "PRE_BUILT_SETUPTOOLS_WHEEL=$(ls dist/*.whl)" >> $GITHUB_ENV
rm -rf setuptools.egg-info # Avoid interfering with the other tests |
After working around a bug in act, I've been able to replicate the failure reliably with the act command above. Moreover, by rolling back to an older docker image using Ubuntu Jammy, I'm able to replicate the failure in a standalone docker image:
|
I've bisected the config from the bottom up and only after re-adding the full metadata section does the problem go away. I'm not yet sure if it's related, but this code is only hit when the pyproject.toml config is present. |
Any chance the cause of the problem is a late/delayed execution of the monkey patching in Explaining a bit better: I was wondering if it is possible that the following is happening?
But if it is a "late change of the binding" in Possible workarounds we can think of (if the supposition above is true):
- import distutils.command.install as orig
+ from distutils.command.install import install as orig_install and then change all occurrences of (that would prevent the error, but I suppose it would make the debian patching ineffective because it happens too late). Footnotes
|
BTW, we had another instance reported in the past of a very similar exception in #4136: File "/usr/lib/python3.10/_distutils_system_mod.py", line 33, in initialize_options
super().initialize_options()
TypeError: super(type, obj): obj must be an instance or subtype of type |
Investigating a bit more, I've put a breakpoint at the top of |
And the behavior on main seems like the right behavior - if SETUPTOOLS_USE_DISTUTILS=stdlib, then the _distutils_system_mod shouldn't be invoked. Using this dockerfile: FROM jaraco/multipy-tox:jammy
RUN apt install -y vim
RUN python3.10 -m pip install wheel build "pyproject-hooks!=1.1"
ENV SETUPTOOLS_USE_DISTUTILS=stdlib
RUN sed -i -e "s/import os/breakpoint()\nimport os/" /usr/lib/python3.10/_distutils_system_mod.py
workdir setuptools
CMD python3.10 -m build --no-isolation And running it with the branch checked out locally, I can see the stack trace when _distutils_system_mod is imported during the build wheel step (and others):
It seems as if But why then is that not an issue when using setup.cfg? There are several places in the code where |
I put a breakpoint in |
This approach seems most sound. I'll try that. |
That does seem to fix the issue. I'll apply that in a separate PR against #4136. |
Looks like the tests now pass when targeting main after #4361. |
No description provided.