-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[BUG] v76.1.0 broke pywin32 builds #4968
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
Comments
One immediately noticeable difference between my local environment and the CI is that I'm using VS Build Tools 2022 on Windows 10, and the CI is using whatever comes with the |
Progress: I found why it wasn't failing locally: the generated I also find that in By removing pyproject definitions and using |
I've bisected the failing commit to be aeefe34
So it sounds like it would be a distutils change ? Oh and to help debugging, here's the traceback to the "breakpoint Exception" I put in pywin32, to try and see why that code is no longer called in >=76 Traceback (most recent call last):
File "<string>", line 2, in <module>
exec(compile('''
~~~~^^^^^^^^^^^^
# This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<32 lines>...
exec(compile(setup_py_code, filename, "exec"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
''' % ('E:\\Users\\Avasam\\Documents\\Git\\pywin32\\setup.py',), "<pip-setuptools-caller>", "exec"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<pip-setuptools-caller>", line 35, in <module>
File "E:\Users\Avasam\Documents\Git\pywin32\setup.py", line 2038, in <module>
dist = setup(
name="pywin32",
...<114 lines>...
],
)
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\__init__.py", line 117, in setup
return distutils.core.setup(**attrs)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\core.py", line 186, in setup
return run_commands(dist)
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands
dist.run_commands()
~~~~~~~~~~~~~~~~~^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands
self.run_command(cmd)
~~~~~~~~~~~~~~~~^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\dist.py", line 999, in run_command
super().run_command(command)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command
cmd_obj.run()
~~~~~~~~~~~^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\command\bdist_wheel.py", line 369, in run
self.run_command("build")
~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command
self.distribution.run_command(command)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\dist.py", line 999, in run_command
super().run_command(command)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command
cmd_obj.run()
~~~~~~~~~~~^^
File "E:\Users\Avasam\Documents\Git\pywin32\setup.py", line 354, in run
build.run(self)
~~~~~~~~~^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\command\build.py", line 140, in run
self.run_command(cmd_name)
~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command
self.distribution.run_command(command)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\dist.py", line 999, in run_command
super().run_command(command)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command
cmd_obj.run()
~~~~~~~~~~~^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\command\build_ext.py", line 99, in run
_build_ext.run(self)
~~~~~~~~~~~~~~^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 375, in run
self.build_extensions()
~~~~~~~~~~~~~~~~~~~~~^^
File "E:\Users\Avasam\Documents\Git\pywin32\setup.py", line 565, in build_extensions
self.build_extension(ext)
~~~~~~~~~~~~~~~~~~~~^^^^^
File "E:\Users\Avasam\Documents\Git\pywin32\setup.py", line 711, in build_extension
build_ext.build_extension(self, ext)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\command\build_ext.py", line 264, in build_extension
_build_ext.build_extension(self, ext)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "C:\Users\Avasam\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 572, in build_extension
objects = self.compiler.compile(
sources,
...<5 lines>...
depends=ext.depends,
)
File "E:\Users\Avasam\Documents\Git\pywin32\setup.py", line 926, in compile
raise Exception("breakpoint")
Exception: breakpoint |
Oh, even better, I found this code is never called. Which makes a lot more sense: from distutils import ccompiler
def my_new_compiler(**kw):
raise Exception("Is this ever called?") # This is never hit in setuptools>=76.1
if "compiler" in kw and kw["compiler"] in (None, "msvc"):
return my_compiler()
return orig_new_compiler(**kw)
# No way to cleanly wedge our compiler sub-class in.
orig_new_compiler = ccompiler.new_compiler
ccompiler.new_compiler = my_new_compiler # type: ignore[assignment] # Assuming the caller will always use only kwargs |
I ended up being able to fix my issue by delaying an import to make sure the function override happens before it's imported/used by setuptools. mhammond/pywin32#2587 I assume the change in distutils that broke that was actually the move of compilers. Anyway, this isn't for setuptools to "fix". Other than by considering the feature request of #2806 |
setuptools version
setuptools>=76.1.0
Python version
All
OS
Windows (x86, x64 and cross-compiled arm64)
Additional environment information
I'd love to provide a proper MRE, but this only happens on GitHub's CI... building works fine on any recent setuptools version locally... Which also makes it quite the puzzle to bissect.
I made sure to clear pip's cache, and delete any
build
,dist
orpywin32.egg-info
folder I had in my local repo.As additional information, @mhammond mentioned that: mhammond/pywin32#2493 (comment)
(as a sidenote, if whatever hack
pywin32
has to do here was handled by setuptools, that'd get it much closer to stop usingdistutils
andMSVCCompiler
directly)Description
Since setuptools v76.1, pywin32's CI builds fail.
I tried specifically with v76.1, v77.0.3 and v88. All the same error.
Expected behavior
A successful build.
How to Reproduce
setuptools>=76.1
inpyproject.toml
:Output
https://github.com/mhammond/pywin32/actions/runs/14719773942/job/41311171599?pr=2587#step:5:799
The text was updated successfully, but these errors were encountered: