[ament_cmake_python] ament_cmake_python_get_python_install_dir public#300
[ament_cmake_python] ament_cmake_python_get_python_install_dir public#300clalancette merged 5 commits intoament:masterfrom
Conversation
ac23800 to
52727d8
Compare
clalancette
left a comment
There was a problem hiding this comment.
Seems reasonable to me. I'll run CI on it next.
| endmacro() | ||
|
|
||
| macro(_ament_cmake_python_get_python_install_dir) | ||
| macro(ament_cmake_python_get_python_install_dir) |
There was a problem hiding this comment.
@MaximilienNaveau now that this is public API, a documentation block would be nice.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
I do agree I will do the change whenever I have some time!
There was a problem hiding this comment.
Sorry I have been under water lately I will try to do this next week!
|
Dear @ALL I hopefully took all comments into account in the last commit, |
…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>
ee3f4a4 to
9bbf02d
Compare
| @@ -0,0 +1,29 @@ | |||
| # Copyright 2014 Open Source Robotics Foundation, Inc. | |||
There was a problem hiding this comment.
@MaximilienNaveau nit:
| # Copyright 2014 Open Source Robotics Foundation, Inc. | |
| # Copyright 2014-2020 Open Source Robotics Foundation, Inc. |
| # Python installation directory. | ||
| # :type package_name: string | ||
| # | ||
| macro(ament_get_python_install_dir python_install_dir_out) |
There was a problem hiding this comment.
@MaximilienNaveau why not a function, as @sloretz suggested?
There was a problem hiding this comment.
Because for now all the public "function" defined in this package are implemented as macros:
- https://github.com/ament/ament_cmake/blob/master/ament_cmake_python/cmake/ament_python_install_module.cmake
- https://github.com/ament/ament_cmake/blob/master/ament_cmake_python/cmake/ament_python_install_package.cmake
Thefunctionis used with an underscore (function(_function_name args)) which indicates them as private in this package.
I can still use a function if you really want to.
There was a problem hiding this comment.
Note that none of those macros pollutes the calling scope. I'd recommend using a function for this case.
There was a problem hiding this comment.
I did not see that, I did the modification.
Signed-off-by: Maximilien Naveau <maximilien.naveau@tuebingen.mpg.de>
8071fd6 to
d049d1e
Compare
Signed-off-by: Maximilien Naveau <maximilien.naveau@tuebingen.mpg.de>
09f64e4 to
d800786
Compare
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. |
Description
This PR has for purpose to answer the issue #277
What has been changed?
A new macro
ament_get_python_install_dirallow the user to access the python installation directory.example of usage