Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds with ament_python broken with sphinx >= 7.0.0 #556

Closed
oysstu opened this issue May 5, 2023 · 2 comments
Closed

Builds with ament_python broken with sphinx >= 7.0.0 #556

oysstu opened this issue May 5, 2023 · 2 comments

Comments

@oysstu
Copy link

oysstu commented May 5, 2023

The following way of obtaining a list of available commands from setup.py is broken on sphinx v7.0.0 and later.

async def _get_available_commands(self, path, env):
output = await check_output(
[executable, 'setup.py', '--help-commands'], cwd=path, env=env)
commands = set()
for line in output.splitlines():
if not line.startswith(b' '):
continue
try:
index = line.index(b' ', 2)
except ValueError:
continue
if index == 2:
continue
commands.add(
line[2:index].decode(locale.getpreferredencoding(False)))
return commands

This occurs because the setuptools integration is deprecated:
sphinx-doc/sphinx#9595 (comment)

The end result is that ament_python continues as normal, but installs the package as an egg without the egg-info.

if 'egg_info' in available_commands:

When building ros, the build will fail on ament_cmake_core because it cannot find ament_package. Egg modules are not imported even if the site-packages directory is in the python-path. It's possible to add something like this to make the egg import

import site
import os
site.addsitedir(os.path.split(__file__)[0])

However, there's further breakage later in the build process in cmake, as it expects template files in a certain location (and not inside the compressed egg).

@14mRh4X0r
Copy link

Funnily enough, this actually seems to be a bug with Sphinx. I've filed a PR with them: sphinx-doc/sphinx#11418

@oysstu
Copy link
Author

oysstu commented May 13, 2023

Resolved in sphinx 7.0.1

@oysstu oysstu closed this as completed May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants