setup: Allow editable wheels.
When building an editable wheel it is not necessary that `build_packages` (or even `run`) is called before calling `get_outputs` (notice the following in https://setuptools.pypa.io/en/latest/userguide/extension.html#supporting-sdists-and-editable-installs-in-build-sub-commands : "Please note that custom sub-commands SHOULD NOT rely on `run()` being executed (or not) to provide correct return values for `get_outputs()`, `get_output_mapping()` or `get_source_files()`. The `get_*` methods should work independently of `run()."). Our implementation relied in the call to `build_packages` to set the name of the synthetic init file. This commit uses a property of the object instead, to compute that name whenever it is necessary. With this change, it is now possible to make editable wheels. -------- kirr: Without the fix `pip install -e` fails as follows on py3: Traceback (most recent call last): File "/home/kirr/src/wendelin/venv/py39.venv/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 155, in run self._create_wheel_file(bdist_wheel) File "/home/kirr/src/wendelin/venv/py39.venv/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 357, in _create_wheel_file files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp) File "/home/kirr/src/wendelin/venv/py39.venv/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 281, in _run_build_commands files, mapping = self._collect_build_outputs() File "/home/kirr/src/wendelin/venv/py39.venv/lib/python3.9/site-packages/setuptools/command/editable_wheel.py", line 266, in _collect_build_outputs files.extend(cmd.get_outputs() or []) File "<string>", line 137, in get_outputs File "/home/kirr/src/wendelin/venv/py39.venv/lib/python3.9/site-packages/setuptools/command/build_py.py", line 78, in __getattr__ return orig.build_py.__getattr__(self, attr) File "/home/kirr/src/wendelin/venv/py39.venv/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__ raise AttributeError(attr) AttributeError: initfile /reviewed-by @kirr /reviewed-on !25
Showing
Please register or sign in to comment