PBR command classes overwrite setup.cfg cmdclass settings
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| PBR |
Low
|
Unassigned | ||
| satori |
Undecided
|
Unassigned |
Bug Description
A user should be able to subclass pbr's command classes found in pbr/packaging.py, and declare that they be used by specifying them in the setup.cfg:
_______
# setup.cfg
[global]
commands = setup.MyLocalIn
_______
The MyLocalInstall class might be defined in the project's setup.py:
_______
# setup.py
from pbr.packaging import LocalInstall
class MyLocalInstall(
# override __init__() and run()
...
_______
After noticing that my custom class wasn't being called, I traced the behavior to here:
https:/
Since pbr.hooks.commands appends to a string of command class names, the pbr classes are always at the end of that string. Any command class specified in setup.cfg that has the same `command_name` (class attribute) as a pbr class defined in pbr.packaging, the class from pbr.packaging will overwrite that class in the config returned by setup_cfg_
description: | updated |
Doug Hellmann (doug-hellmann) wrote : | #1 |
Sam Stavinoha (smlstvnh) wrote : | #2 |
I have seen various threads on extending setuptools command classes...
http://
http://
http://
but for me it was to add user_options and execute additional tasks based on those options. e.g. installing an additional package for a tag like --with-redis, where in my code I try, except imports when constructing the database client instance.
Regarding this bug:
The only time this occurs is if a command class is specified for which pbr has a corresponding command class (has the same `command_name`). I created custom classes for 'develop' and 'install', but only the class I created for 'install' was being overwritten, which I thought was pretty odd behavior.
I have other packages using this type of setup for custom command classes, and no matter the purpose of the customization, I would really like to start using pbr on all of those projects, but this prevents me from doing so.
I went ahead and submitted a patch just in case:
Changed in pbr: | |
status: | New → Triaged |
importance: | Undecided → Low |
Change abandoned by lifeless (<email address hidden>) on branch: master
Review: https:/
Reason: WIP is still in the review queue, marking abandoned.
I'm not certain this is something we want to support in pbr.
What's the use case for overriding the install command?