Skip to content
Snippets Groups Projects
Unverified Commit f13f786a authored by Robin De Schepper's avatar Robin De Schepper Committed by GitHub
Browse files

Fixed MRO and code duplication in `setup.py` (#1672)

The duplication arose from slightly more complicated composition than usual but could be resolved by proper MRO, it took me a few passes from its original form as well before I figured out the situation is not as complicated as it seems.

`super()` is equal to `super(cls, self)` where `cls` is obtained from the current function's class scope. If arg 2  is an object it will start an MRO search of the object, but skipping classes before the 1st arg type is encountered. In our case with the following base classes: `(_command_template, base_command_class)` this means we can define our base logic in `_command_template` and use `super()` calls there to traverse the MRO in `(base_command_class,)`, so by simply defining `class install_command(_command_template, install)` and `bdist_wheel_command(_command_template, bdist_wheel)` our MRO issue is solved and the duplication removed.
parent c34b7c96
No related branches found
No related tags found
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment