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

Windows python debug #153

Merged
merged 7 commits into from
Jun 22, 2016
Merged

Windows python debug #153

merged 7 commits into from
Jun 22, 2016

Conversation

mikaelarguedas
Copy link
Member

After discussion with @dirk-thomas, we will modify the python interpreter only for packages generating/using python extensions and not for the entire build process. If people want to generate executables in Debug mode they'll have to invoke ament_tools with python_d.

This adds the suffix and cmake logic to use the python debug interpreter when generating python extensions.

CI with change: http://ci.ros2.org/job/ci_windows/1455/#showFailuresLink
Nightly: http://ci.ros2.org/view/nightly/job/nightly_win_deb/146/#showFailuresLink

@mikaelarguedas mikaelarguedas added the in review Waiting for review (Kanban column) label Jun 13, 2016
@mikaelarguedas mikaelarguedas self-assigned this Jun 13, 2016
@@ -211,7 +222,11 @@ if(PYTHONINTERP_FOUND)
endif()

if(WIN32)
set(PythonExtra_EXTENSION_EXTENSION ".pyd")
if("${CMAKE_BUILD_TYPE} " STREQUAL "Debug ")
set(PythonExtra_EXTENSION_EXTENSION "_d.pyd")
Copy link
Member

Choose a reason for hiding this comment

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

Should this also happen when building debug but not having a debug interpreter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not necessarily, but if one doesn't have a debug interpreter, Visual Studio won't be able to link against it and the compilation will fail. So the suffix of the extensions would not matter in that case.

Copy link
Member

Choose a reason for hiding this comment

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

If this can be detected at CMake time wouldn't it be better to print a clear error message then let it fail later with a not that clear error?

Copy link
Member Author

Choose a reason for hiding this comment

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

PythonExtra now performs the existence test of the debug interpreter and throw an error if unable to find it. 52eb0f4

@mikaelarguedas mikaelarguedas added in progress Actively being worked on (Kanban column) and removed in review Waiting for review (Kanban column) labels Jun 13, 2016
@mikaelarguedas
Copy link
Member Author

Round2: the goal here is to use the python_d.exe only when needed instead of for the entire build process.

  • PythonExtra module creates a PYTHON_DBG_EXECUTABLE with the path of python_d.exe and throw an error is it can't be found
  • ament_cmake_nosetests now take the python executable as a parameter to allow using python_d on a per test basis
  • Modules who need the PYTHON_EXECUTABLE variable overwrite it in their CMakeLists and restore it to the previous value once done (I'm not sure the way it's done is the best way to do it in CMake )

CI passed with the expected result: http://ci.ros2.org/job/ci_windows/1481/

Note: people who want to build ament_python packages to generate executables (setuptools) will need to call ament.py with python_d.

@mikaelarguedas mikaelarguedas added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jun 17, 2016
@dirk-thomas
Copy link
Member

The new variable should following the naming scheme of other CMake variables (which append the build type for customization). So I would suggest PYTHON_EXECUTABLE_DEBUG.

@mikaelarguedas
Copy link
Member Author

Makes sense. Renamed it in all packages using it.

@mikaelarguedas
Copy link
Member Author

@ros2/ros2_team please review this and the associated PRs

@@ -128,6 +128,18 @@ if(PYTHONINTERP_FOUND)
message(STATUS "Using PythonExtra_LIBRARIES: ${PythonExtra_LIBRARIES}")
else()
find_package(PythonLibs 3.5 REQUIRED)
if(WIN32 AND "${CMAKE_BUILD_TYPE} " STREQUAL "Debug ")
Copy link
Member

@dirk-thomas dirk-thomas Jun 22, 2016

Choose a reason for hiding this comment

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

Please remove the quotes and explicit variable expansion as well as the trailing space.

Same below.

Copy link
Member Author

Choose a reason for hiding this comment

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

done 11fa14c

@dirk-thomas
Copy link
Member

Beside the comments +1.

@mikaelarguedas
Copy link
Member Author

needs rebase and a round of CI before merging

@mikaelarguedas
Copy link
Member Author

new CI job to validate after rebase: Build Status

@mikaelarguedas
Copy link
Member Author

@dirk-thomas does the +1 covers the associated PRs?

@mikaelarguedas
Copy link
Member Author

I'll fix the variable expansion/whitespace in the associated PRs too

@dirk-thomas
Copy link
Member

I just review the referenced PRs individually.

@mikaelarguedas
Copy link
Member Author

thanks!

@mikaelarguedas
Copy link
Member Author

Windows Debug job: Build Status

@mikaelarguedas
Copy link
Member Author

CI passed, so I'll merge this now

@mikaelarguedas mikaelarguedas merged commit f349b42 into master Jun 22, 2016
@mikaelarguedas mikaelarguedas deleted the windows_python_debug branch June 22, 2016 19:53
@mikaelarguedas mikaelarguedas removed the in review Waiting for review (Kanban column) label Jun 22, 2016
ahcorde pushed a commit to erlerobot/rosidl that referenced this pull request Jul 22, 2016
* added _d suffix to generated extensions

* look for python debug interpreter

* adding error message and PYTHON_DBG_EXECUTABLE variable

* remove trailing whitespace

* rename PYTHON_DBG_EXECUTABLE to PYTHON_EXECUTABLE_DEBUG

* quote entire error message

* cmake3.5 remove trailing whitespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants