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

Python test fails when installing with DESTDIR #422

Open
cottsay opened this issue Jan 26, 2024 · 2 comments
Open

Python test fails when installing with DESTDIR #422

cottsay opened this issue Jan 26, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@cottsay
Copy link

cottsay commented Jan 26, 2024

Environment

  • OS Version: Any
  • Source or binary build?
    Source @ 2b66954

Description

  • Expected behavior: Tests execute successfully
  • Actual behavior: basic_TEST.py can't find gz.msgs10 to import

Steps to reproduce

  1. mkdir -p build && cd build && cmake .. && make
  2. make install DESTDIR=/tmp/foobar
  3. ctest

Output

The following tests FAILED:
	 13 - basic_TEST.py (Failed)

The test sets PYTHONPATH based on where it anticipates the Python module will be installed to, however:

  1. In general, a developer can typically invoke ctest prior to installing a project and it should use artifacts from the build directories for testing. The Python tests in gz-math behave like this, for example.
  2. The existing prediction doesn't work when GZ_PYTHON_INSTALL_PATH is changed, perhaps by setting USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION=ON.
  3. When DESTDIR is used to direct make where to install files instead of CMAKE_INSTALL_PREFIX, the final target directory isn't known to ctest at all.
  4. By overriding PYTHONPATH unconditionally, it's not possible to set PYTHONPATH manually prior to invoking ctest. Without resorting to using CMAKE_INSTALL_PREFIX or modifying the cmake, it's impossible to get the test to pass.

Note that DESTDIR is the installation root mechanism used in both Debian and RPM builds, but colcon uses CMAKE_INSTALL_PREFIX because DESTDIR is a Makefile concept and doesn't typically work on Windows.

@cottsay cottsay added the bug Something isn't working label Jan 26, 2024
@azeey
Copy link
Contributor

azeey commented Jan 26, 2024

I think we have the same situation in gz-transport as well (gazebosim/gz-transport#441 (comment)).

@scpeters
Copy link
Member

I think we could copy the approach from gz-math7:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To do
Development

No branches or pull requests

3 participants