Skip to content

[ament_cmake_python] ament_cmake_python_get_python_install_dir public#300

Merged
clalancette merged 5 commits intoament:masterfrom
MaximilienNaveau:master
Dec 8, 2020
Merged

[ament_cmake_python] ament_cmake_python_get_python_install_dir public#300
clalancette merged 5 commits intoament:masterfrom
MaximilienNaveau:master

Conversation

@MaximilienNaveau
Copy link
Copy Markdown

@MaximilienNaveau MaximilienNaveau commented Oct 28, 2020

Description

This PR has for purpose to answer the issue #277

What has been changed?

A new macro ament_get_python_install_dir allow the user to access the python installation directory.

example of usage

ament_get_python_install_dir(path_to_python_install_dir)
install(python_bindings_target DESTINATION ${path_to_python_install_dir}/${PROJECT_NAME})

Copy link
Copy Markdown
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me. I'll run CI on it next.

@clalancette
Copy link
Copy Markdown
Contributor

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

endmacro()

macro(_ament_cmake_python_get_python_install_dir)
macro(ament_cmake_python_get_python_install_dir)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaximilienNaveau now that this is public API, a documentation block would be nice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend making this a function() too with an output variable to avoid other variables it sets (_python_code, _output, _result) from being visible to the code that calls this. I also recommend shortening the name.

This

_ament_cmake_python_get_python_install_dir()

would become this:

ament_get_python_install_dir(PYTHON_INSTALL_DIR)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree I will do the change whenever I have some time!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaximilienNaveau friendly ping

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I have been under water lately I will try to do this next week!

@clalancette clalancette added more-information-needed Further information is required requires-changes labels Nov 18, 2020
@MaximilienNaveau
Copy link
Copy Markdown
Author

Dear @ALL I hopefully took all comments into account in the last commit,
Please let me know if something is wrong.

Maximilien Naveau added 3 commits November 25, 2020 12:00
…ir a public interface.

Signed-off-by: Maximilien Naveau <maximilien.naveau@tuebingen.mpg.de>
- Create a file ament_cmake_python/cmake/ament_get_python_install_dir.cmake containing a macro to access the python installation directory.
- In ament_cmake_python/ament_cmake_python-extras.cmake restore the way to find the python directory,
  and include the ament_cmake_python/cmake/ament_get_python_install_dir.cmake

Signed-off-by: Maximilien Naveau <maximilien.naveau@tuebingen.mpg.de>
Signed-off-by: Maximilien Naveau <maximilien.naveau@tuebingen.mpg.de>
@@ -0,0 +1,29 @@
# Copyright 2014 Open Source Robotics Foundation, Inc.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaximilienNaveau nit:

Suggested change
# Copyright 2014 Open Source Robotics Foundation, Inc.
# Copyright 2014-2020 Open Source Robotics Foundation, Inc.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

# Python installation directory.
# :type package_name: string
#
macro(ament_get_python_install_dir python_install_dir_out)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaximilienNaveau why not a function, as @sloretz suggested?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because for now all the public "function" defined in this package are implemented as macros:

I can still use a function if you really want to.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that none of those macros pollutes the calling scope. I'd recommend using a function for this case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not see that, I did the modification.

Signed-off-by: Maximilien Naveau <maximilien.naveau@tuebingen.mpg.de>
Signed-off-by: Maximilien Naveau <maximilien.naveau@tuebingen.mpg.de>
Copy link
Copy Markdown

@hidmic hidmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once CI goes green!

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@MaximilienNaveau
Copy link
Copy Markdown
Author

LGTM once CI goes green!

* Linux [![Build Status](https://camo.githubusercontent.com/e2876de455e260538d341f2332b2c58b33096e883171dc81ec5b153871e8cde1/687474703a2f2f63692e726f73322e6f72672f6275696c645374617475732f69636f6e3f6a6f623d63695f6c696e7578266275696c643d3133323039)](http://ci.ros2.org/job/ci_linux/13209/)

* Linux-aarch64 [![Build Status](https://camo.githubusercontent.com/bcc5670e4fe22b2d6bd43f620f6b73d68db2416c7327d353fd911e11f164f988/687474703a2f2f63692e726f73322e6f72672f6275696c645374617475732f69636f6e3f6a6f623d63695f6c696e75782d61617263683634266275696c643d38313430)](http://ci.ros2.org/job/ci_linux-aarch64/8140/)

* macOS [![Build Status](https://camo.githubusercontent.com/8c12935526b4e1b50b6a87fe788ed94162c6567acbf3f13e9ce16e18aeedee47/687474703a2f2f63692e726f73322e6f72672f6275696c645374617475732f69636f6e3f6a6f623d63695f6f7378266275696c643d3130393235)](http://ci.ros2.org/job/ci_osx/10925/)

* Windows [![Build Status](https://camo.githubusercontent.com/3a644035d7a4f36eb2db6ab4b16019a601f33affad2dc927d39e4f6b4ea97fae/687474703a2f2f63692e726f73322e6f72672f6275696c645374617475732f69636f6e3f6a6f623d63695f77696e646f7773266275696c643d3133323236)](http://ci.ros2.org/job/ci_windows/13226/)

So should it be merged?

@clalancette
Copy link
Copy Markdown
Contributor

So should it be merged?

Yes. The yellow builds are known flakey tests, so I'll go ahead and merge this. Thanks for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

more-information-needed Further information is required requires-changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants