msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.22k stars 1.19k forks source link

python distutils raise a python error (instead of a user message) #8352

Open GitMensch opened 3 years ago

GitMensch commented 3 years ago

.. if gcc (or ld) could not be executed (or is not found) for whatever reason

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "D:\Temp\pip-install-s2jo31s5\wrapt_c4fc852e51444e2092e4c5a0058272d5\setup.py", line 102, in <module>
        run_setup(with_extensions=True)
      File "D:\Temp\pip-install-s2jo31s5\wrapt_c4fc852e51444e2092e4c5a0058272d5\setup.py", line 72, in run_setup
        setup(**setup_kwargs_tmp)
      File "D:\MSYS2\lib\python3.8\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "D:\MSYS2\lib\python3.8\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "D:\MSYS2\lib\python3.8\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "D:\MSYS2\lib\python3.8\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "D:\MSYS2\lib\python3.8\distutils\command\install.py", line 546, in run
        self.run_command('build')
      File "D:\MSYS2\lib\python3.8\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:\MSYS2\lib\python3.8\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "D:\MSYS2\lib\python3.8\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "D:\MSYS2\lib\python3.8\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:\MSYS2\lib\python3.8\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "D:\Temp\pip-install-s2jo31s5\wrapt_c4fc852e51444e2092e4c5a0058272d5\setup.py", line 25, in run
        build_ext.run(self)
      File "D:\MSYS2\lib\python3.8\distutils\command\build_ext.py", line 307, in run
        self.compiler = new_compiler(compiler=self.compiler,
      File "D:\MSYS2\lib\python3.8\distutils\ccompiler.py", line 1034, in new_compiler
        return klass(None, dry_run, force)
      File "D:\MSYS2\lib\python3.8\distutils\cygwinccompiler.py", line 310, in __init__
        CygwinCCompiler.__init__ (self, verbose, dry_run, force)
      File "D:\MSYS2\lib\python3.8\distutils\cygwinccompiler.py", line 127, in __init__
        if self.ld_version >= "2.10.90":
    TypeError: '>=' not supported between instances of 'NoneType' and 'str'
naveen521kk commented 3 years ago

Distutils doesn't support mingw. Why not use setuptools? (just never mind I didn't read things fully)

GitMensch commented 3 years ago

Distutils doesn't support mingw. Why not use setuptools?

I don't know why pip uses this, but it still does (that version of pip was installed by installing the python package, then executing python -m ensurepip (per python's 3.x docs).

There's a patch here for distutils already, so I assume MSYS2 supports it - see related PR which handles this issue better.