-
Notifications
You must be signed in to change notification settings - Fork 280
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
add win_ros script wrappers to make python scripts executable #978
add win_ros script wrappers to make python scripts executable #978
Conversation
* Return python process exit code from wrapper * Initialize exit_code
Can you please describe the differences (in terms of pros and cons) of these two approaches and why both should be provided. |
batch script wrapper
con:
win32 executable wrapper
con:
The idea of such kind of wrappers were borrowed from an earlier ros-win project, so we were trying to keep as much unchanged as possible while updating the content. This, I believe, is the major reason why both are kept. The batch script wrappers for catkin executables were introduced during the proof-of-concept phase, they could totally be changed into the win32 wrappers. The reason why such kind of wrappers are needed is because Meantime, the pros and cons of this wrapper method are as follows:
con:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not return error code from the underlying python process
This on its own is reason enough for me to consider to only offer the second option.
…ove platform check into function, change macro into function, add target parameter
looking back at this change, this seems like a hacky way of fixing Python scripts on Windows. @seanyen-msft found the use of setuptools in Python to generate console_scripts, which should help avoid the executable generation problem (Python scripts needs a wrapper to be called on Windows). what's even better is that this would be a maintained method I will be doing some prototyping to see if this is going to work. @wjwwood and @dirk-thomas, does this sound like something we/ros could use? |
We use the |
good to know, I'll update on this thread while I try. we have a feeling that having some sort of wrapper might later on become hard to maintain |
I did some investigation and prototyping on this and here are a little of conclusion:
some thoughts from working on this:
|
Thanks for sharing your expertise! This would make
Sorry for the confusion, updated on this ticket to address all the comments! |
I polished the CMake function Since the |
thanks for helping out! it looks a lot better than what I could come up with my understand of CMake =) and thanks for moving quick question, do we want to change the name mentioned in wrapper.cpp.in?
update to invoke |
Thanks - better safe than sorry. Especially since releasing a patch for
Since the file is based on their work I would rather keep it as is. |
updated
totally! good news is, this change should not affect any ROS installation on Linux since it's guarded to be Windows-specific. |
That doesn't sound reasonable to me. If for whatever reason the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for iterating on this patch.
Are you confident that the current state covers the necessary use cases on Windows? Or would you like to have more time for testing? I am mostly asking to avoid doing a patch release soon 😉
Yes, this should cover basic use cases, should be good for the next If there should be any further (major) improvement/fix/change, I think that could go into a separate release (depends on future development plans). Given our time frame, (imo) it would be good enough if this immediate release of
At this point, we have verified that current state of Is there a release plan in vision? As soon as we get |
Sounds good. I am able to do a release tomorrow... |
looking into an error found while building error message:
the root cause for this seems seems to be |
Looking at the source of that package I don't see why this is happening. But any package could explicitly not select the C++ compiler by calling e.g. In general I am not sure if there is a way in CMake to add |
You might want to try enable_language(). |
Thanks for sharing your expertise! That's also what I looked into, and I have updated this change accordingly. To verify the
I looked into the source code of Meantime, this issue has been addressed for our
what's happening next:
|
did some verification for https://ros-win.visualstudio.com/ros-win/_build/results?buildId=3344 =)
|
Thank you for this patch and for iterating on it. |
Python scripts are executable (can be directly called on command line with the help of the shebang line) on Ubuntu, so built packages can be directly used in command line. However, without extra setup on Windows, python scripts cannot be executed directly as on Ubuntu. To work around this issue, we utilize 2 kinds of script wrappers to execute the python scripts.
One way of doing it is creating a batch script that simply adds that
python
prefix before the python script; the other way of doing it is to wrap the python script inside a win32 wrapper, and execute it using theCreateProcess
call (and return error code).Similar to the change to
CMakeLists.txt
in this pull request, adding aif(WIN32) + add_windows_helper
would be the easiest way to create executable for packages.