I did submit a patch (https://review.openstack.org/#/c/61875) to fix this issue, but now that I am digging deeper into the magic I think I have found a simplier way. We just need to stop setup.py from being imported. Since when running 'python setup.py build_sphinx' the setup module is imported as __main__ we can just use that like:
diff --git i/pbr/packaging.py w/pbr/packaging.py
index a066d3b..37b41c6 100644
--- i/pbr/packaging.py
+++ w/pbr/packaging.py
@@ -636,6 +636,9 @@ try:
from sphinx import config
from sphinx import setup_command
+ import sys
+ sys.modules['setup'] = sys.modules['__main__']
+
class LocalBuildDoc(setup_command.BuildDoc):
I did submit a patch (https:/ /review. openstack. org/#/c/ 61875) to fix this issue, but now that I am digging deeper into the magic I think I have found a simplier way. We just need to stop setup.py from being imported. Since when running 'python setup.py build_sphinx' the setup module is imported as __main__ we can just use that like:
diff --git i/pbr/packaging.py w/pbr/packaging.py
index a066d3b..37b41c6 100644
--- i/pbr/packaging.py
+++ w/pbr/packaging.py
@@ -636,6 +636,9 @@ try:
from sphinx import config
from sphinx import setup_command
+ import sys 'setup' ] = sys.modules[ '__main_ _'] setup_command. BuildDoc) :
+ sys.modules[
+
class LocalBuildDoc(
This is sort of a hack and I'm not entirely sure where the best place to put those lines. Right now this is not on Keystone's critical path because I have created a workaround: http:// git.openstack. org/cgit/ openstack/ keystone/ commit/ ?id=3f27b309