2014-03-31 18:46:12 |
Sam Stavinoha |
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:
_____________________________________
[global]
commands = setup.MyLocalInstall
_____________________________________
The MyLocalInstall class might be defined in the project's setup.py:
_____________________________________
# setup.py
from pbr.packaging import LocalInstall
class MyLocalInstall(LocalInstall):
# override __init__() and run()
...
_____________________________________
After noticing that my custom class wasn't being called, I traced the behavior to here:
https://github.com/openstack-dev/pbr/blob/master/pbr/util.py#L360
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_to_setup_kwargs(). |
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.MyLocalInstall
_____________________________________
The MyLocalInstall class might be defined in the project's setup.py:
_____________________________________
# setup.py
from pbr.packaging import LocalInstall
class MyLocalInstall(LocalInstall):
# override __init__() and run()
...
_____________________________________
After noticing that my custom class wasn't being called, I traced the behavior to here:
https://github.com/openstack-dev/pbr/blob/master/pbr/util.py#L360
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_to_setup_kwargs(). |
|