Closed
Description
setuptools version
setuptools===60.2.0
Python version
Python 3.8
OS
Ubuntu 20.04
Additional environment information
build 0.7.0
Description
Having the cmdclass
option defined in setup.cfg
causes python -m build
to fail with a ModuleNotFoundError
.
Expected behavior
I expect to be able to customize/override setuptools
commands in a project with a PEP 517-style build system with no setup.py
.
The code for the overriden/customized commands resides in a python module at the root of the repo and is being pointed out with the cmdclass
option in setup.cfg
.
How to Reproduce
- Download and unzip this minimal example: example.zip
- Move to the top folder of the unzipped contents
- Issue
python -m build
- Behold, no source or wheel distribution gets built. All we get is a
ModuleNotFoundError
Output
zluudg@computer > python3 -m build
/home/zluudg/.local/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (setuptools==60.2.0, wheel)
* Getting dependencies for sdist...
Traceback (most recent call last):
File "/home/zluudg/.local/lib/python3.8/site-packages/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/home/zluudg/.local/lib/python3.8/site-packages/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/zluudg/.local/lib/python3.8/site-packages/pep517/in_process/_in_process.py", line 297, in get_requires_for_build_sdist
return hook(config_settings)
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/build_meta.py", line 167, in get_requires_for_build_sdist
return self._get_build_requires(config_settings, requirements=[])
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
self.run_setup()
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 1, in <module>
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/__init__.py", line 155, in setup
return distutils.core.setup(**attrs)
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 122, in setup
dist.parse_config_files()
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/_virtualenv.py", line 21, in parse_config_files
result = old_parse_config_files(self, *args, **kwargs)
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/dist.py", line 804, in parse_config_files
parse_configuration(
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/config.py", line 150, in parse_configuration
options.parse()
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/config.py", line 498, in parse
section_parser_method(section_options)
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/config.py", line 469, in parse_section
self[name] = value
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/config.py", line 222, in __setitem__
value = parser(value)
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/config.py", line 654, in _parse_cmdclass
return {k: resolve_class(v) for k, v in self._parse_dict(value).items()}
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/config.py", line 654, in <dictcomp>
return {k: resolve_class(v) for k, v in self._parse_dict(value).items()}
File "/tmp/build-env-dwvi2g6f/lib/python3.8/site-packages/setuptools/config.py", line 650, in resolve_class
module = __import__(pkg_name)
ModuleNotFoundError: No module named 'custom_build'
ERROR Backend subproccess exited when trying to invoke get_requires_for_build_sdist
Code of Conduct
- I agree to follow the PSF Code of Conduct