Skip to content

Ros2 port#52

Merged
mlautman merged 40 commits intocrystal-develfrom
ros2_port
Oct 26, 2018
Merged

Ros2 port#52
mlautman merged 40 commits intocrystal-develfrom
ros2_port

Conversation

@brawner
Copy link
Copy Markdown
Contributor

@brawner brawner commented Oct 20, 2018

This ports python_qt_binding to work with ros2 crystal. I've also added tests to ensure pyqt or pyside are installed correctly and the package works as intended.

@ghost ghost assigned brawner Oct 20, 2018
@ghost ghost added the in progress label Oct 20, 2018
@brawner
Copy link
Copy Markdown
Contributor Author

brawner commented Oct 20, 2018

Link to test
https://ci.ros2.org/job/ci_linux/5305/

@brawner
Copy link
Copy Markdown
Contributor Author

brawner commented Oct 20, 2018

Ok, CI build failed. I have some work to do I guess.

@mlautman
Copy link
Copy Markdown
Member

@brawner Ping me when this is ready to be reviewed

Copy link
Copy Markdown
Contributor

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

When moving / renaming existing file (like python_qt_binding/binding_helper.py) please use a separate commit for that - that will "help" git to track the history of the file.

CMakeLists.txt Outdated
catkin_python_setup()
ament_python_install_package(${PROJECT_NAME})

set(python_qt_binding_CMAKE_DIRS cmake)
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.

Where is this variable being used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's not, removed.

CMakeLists.txt Outdated
cmake/sip_configure.py
cmake/sip_helper.cmake
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake)
DESTINATION share/${PROJECT_NAME}/cmake/)
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.

No trailing slash.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

CMakeLists.txt Outdated
ament_lint_auto_find_test_dependencies()

ament_add_pytest_test(pqt_test test
PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}"
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.

This is the default value so it doesn't need to be passed explicitly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed

CMakeLists.txt Outdated

ament_add_pytest_test(pqt_test test
PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}"
APPEND_ENV AMENT_PREFIX_PATH=${ament_index_build_path}
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.

Where is the variable ament_index_build_path being defined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leftover from a copy-paste job. Removed append to AMENT_PREFIX_PATH

LICENSE Outdated
@@ -0,0 +1,202 @@

Apache License
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.

The existing code is licensed under BSD. You can't change the license of it without an agreement of all contributors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Whoops, sorry! Trying to pass test_copyright.py tests, but I had removed that awhile ago.

from python_qt_binding.binding_helper import \
loadUi, QT_BINDING, QT_BINDING_MODULES, QT_BINDING_VERSION

print('Qt5 Python Binding {}: Version {}'.format(QT_BINDING, QT_BINDING_VERSION))
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.

This message was probably used for debugging and should be removed again.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This line was added, as well as the loadUI = loadUi so that flake8 would not complain about unused variables. Because the init exposes loadUI, QT_BINDING and QT_BINDING_VERSION, but doesn't use them in the file flake8 thinks they are unused.

@dirk-thomas Do you have a recommended resolution?

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.

You can suppress a specific flake8 warning by appending # noqa: X123 to the line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding noqa: F401 to suppress unused imports. I guess it's recommended to add these to an all variable, but I'm not sure how that would work with the dynamic module imports associated with this package.

loadUi, QT_BINDING, QT_BINDING_MODULES, QT_BINDING_VERSION

print('Qt5 Python Binding {}: Version {}'.format(QT_BINDING, QT_BINDING_VERSION))
loadUi = loadUi
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.

What is this line about?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in favor of noqa: F401

@@ -1,5 +1,3 @@
#!/usr/bin/env python
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.

Please keep this line. It allows to invoke the file directly to test the selected binding.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverting this line


def loadUi(uifile, baseinstance=None, custom_widgets=None):
"""
Load a provided UI file using PySide2.
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.

The reference of PySide2 is incorrect. This function uses the selected binding.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Corrected

setup.py Outdated

try:
from setuptools import setup
from setuptools import setup, find_packages
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.

In the case of an exception the symbol find_packages isn't defined and would therefore fail later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was part of debugging, reverting to the old setup.py

@dirk-thomas
Copy link
Copy Markdown
Contributor

Also moving the Python package out of the src folder would be good to either apply in the "upstream" ROS 1 branch or not do it on the ROS 2 branch - since it makes porting patches between them more difficult.

@brawner
Copy link
Copy Markdown
Contributor Author

brawner commented Oct 24, 2018

@dirk-thomas from your comments on slack, I found how to set the PACKAGE_DIR argument with ament_python_install_package. Moving files back to src

@brawner
Copy link
Copy Markdown
Contributor Author

brawner commented Oct 25, 2018

CI build and tests passed
https://ci.ros2.org/job/ci_linux/5343/

CMakeLists.txt Outdated
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake)
DESTINATION share/${PROJECT_NAME}/cmake)

if(BUILD_TESTING)
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.

Everything from here shouldn't be indented.

CMakeLists.txt Outdated
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

ament_add_pytest_test(pqt_test test
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.

pqt_test - hat does pqt stand for?

CONTRIBUTING.md Outdated
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
~~~
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.

This is still mentioning the wrong license.

@@ -0,0 +1,2 @@
# location of cmake files in installspace
set(python_qt_binding_EXTRAS_DIR "${python_qt_binding_DIR}")
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.

If the variable isn't used anywhere (in downstream packages?) then it can be removed.

@ghost ghost assigned dirk-thomas Oct 25, 2018
@dirk-thomas
Copy link
Copy Markdown
Contributor

I syncronized the crystal-devel branch to contain the latest state of kinetic-devel so this needs to be rebased.

Copy link
Copy Markdown
Contributor

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

LGTM

@mlautman mlautman merged commit a527d32 into crystal-devel Oct 26, 2018
@ghost ghost removed the in progress label Oct 26, 2018
@mlautman mlautman deleted the ros2_port branch October 26, 2018 00:07
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.

3 participants