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

Port embedSdf script from Ruby to Python3 and provide unittests #884

Merged
merged 15 commits into from
Feb 7, 2023

Conversation

Bi0T1N
Copy link
Contributor

@Bi0T1N Bi0T1N commented Mar 17, 2022

🎉 New feature

Removes the Ruby dependency and thus is related to/partially solves #274 (for complete Ruby dependency removal #643 should be merged as well).

Summary

This PR converts the script that creates the .cc file for mapping of SDF filename and SDF content from Ruby to Python. Additionally a few unittests are added for the function that uses the mapping and which wasn't tested before.
For details see also the commit messages.

Note: Since I wasn't sure if this change counts as an API/ABI change or not, I targeted it to main.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@github-actions github-actions bot added the 🌱 garden Ignition Garden label Mar 17, 2022
@scpeters
Copy link
Member

@osrf-jenkins run tests please

src/SDF_TEST.cc Outdated Show resolved Hide resolved
@Bi0T1N Bi0T1N force-pushed the embeddedsdf_refactoring branch 2 times, most recently from 625bc4d to 934cac5 Compare March 18, 2022 21:27
@chapulina chapulina added the needs upstream release Blocked by a release of an upstream library label Apr 4, 2022
@chapulina chapulina requested a review from mjcarroll May 2, 2022 18:54
@codecov
Copy link

codecov bot commented Jul 1, 2022

Codecov Report

Merging #884 (7604ba4) into main (f39f571) will increase coverage by 0.01%.
The diff coverage is n/a.

❗ Current head 7604ba4 differs from pull request most recent head 2d375e3. Consider uploading reports for the commit 2d375e3 to get more accurate results

@@            Coverage Diff             @@
##             main     #884      +/-   ##
==========================================
+ Coverage   87.20%   87.21%   +0.01%     
==========================================
  Files         124      124              
  Lines       16229    16229              
==========================================
+ Hits        14152    14154       +2     
+ Misses       2077     2075       -2     
Impacted Files Coverage Δ
src/SDF.cc 95.23% <0.00%> (+1.19%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Bi0T1N Bi0T1N requested a review from scpeters July 2, 2022 14:00
@chapulina chapulina added the bug Something isn't working label Jul 23, 2022
Copy link
Collaborator

@azeey azeey left a comment

Choose a reason for hiding this comment

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

I left a few minor comments, but overall, this looks great! Thank you for your
contribution!

embedSdf.rb has since been updated to include a new SDF version (1.10). Do
you mind updating the python code to reflect that?

sdf/embedSdf.py Outdated Show resolved Hide resolved
sdf/embedSdf.py Outdated Show resolved Hide resolved
sdf/embedSdf.py Outdated Show resolved Hide resolved
src/SDF_TEST.cc Outdated Show resolved Hide resolved
@chapulina chapulina changed the base branch from main to sdf13 August 5, 2022 19:05
@Bi0T1N Bi0T1N requested review from azeey and removed request for mjcarroll and scpeters August 20, 2022 21:17
@Bi0T1N
Copy link
Contributor Author

Bi0T1N commented Aug 26, 2022

I fixed the merge conflict that was due to the embedSdf.rb already being deleted while changes for SDF 1.10 have been added by targeting branch sdf13...it bases on sdf13 now.

@chapulina chapulina removed the needs upstream release Blocked by a release of an upstream library label Aug 26, 2022
this uses internal functions from GoogleTests
to capture the stderr message but according to the documentation
it should be fine to use them:
// All macros ending with _ and symbols defined in an
// internal namespace are subject to change without notice.  Code
// outside Google Test MUST NOT USE THEM DIRECTLY.  Macros that don't
// end with _ are part of Google Test's public API and can be used by
// code outside Google Test.
see https://github.com/google/googletest/blob/main/googletest/include/gtest/internal/gtest-port.h

Signed-off-by: Bi0T1N <[email protected]>
- removes Ruby dependency (see gazebosim#274)
- improvements for cpplint checks (e.g. copyright header)

Signed-off-by: Bi0T1N <[email protected]>
it should not be operating system dependent because it is
hardcoded to '/' in the C++ file that performs the lookup

Signed-off-by: Bi0T1N <[email protected]>
it's the same approach as in parser_TEST.cc

Signed-off-by: Bi0T1N <[email protected]>
@Bi0T1N
Copy link
Contributor Author

Bi0T1N commented Dec 17, 2022

Apparently I misinterpreted the comments and made the changes to the wrong project. Anyway, rebased my changes on main and added Python interpreter as a build dependency with gz_build_error.

@Bi0T1N Bi0T1N requested a review from scpeters December 17, 2022 17:08
@azeey azeey requested a review from mjcarroll February 3, 2023 18:03
@azeey
Copy link
Collaborator

azeey commented Feb 3, 2023

@scpeters any remaining issues?

@azeey azeey merged commit 0642526 into gazebosim:main Feb 7, 2023
@Bi0T1N Bi0T1N deleted the embeddedsdf_refactoring branch February 10, 2023 16:09
mjcarroll added a commit that referenced this pull request Feb 16, 2023
Converts the script that creates the .cc file for mapping of SDF filename and SDF content from Ruby to Python. Additionally a few unittests are added for the function that uses the mapping and which wasn't tested before.

Signed-off-by: Bi0T1N <[email protected]>
Co-authored-by: Bi0T1N <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>
mjcarroll added a commit that referenced this pull request Feb 16, 2023
These won't be used as part of the cmake build on this branch, but are
useful for generating the same file from bazel.

Co-authored-by: Bi0T1N <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
@scpeters scpeters mentioned this pull request Sep 27, 2023
7 tasks
mjcarroll added a commit that referenced this pull request Dec 13, 2023
* Cherry-pick the python3 embedSdf script and tests (#884)

These won't be used as part of the cmake build on this branch, but are
useful for generating the same file from bazel.

Co-authored-by: Bi0T1N <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>

* Improvements to embedSdf script

Signed-off-by: Michael Carroll <[email protected]>

* Update sdf/CMakeLists.txt

Signed-off-by: Michael Carroll <[email protected]>

Co-authored-by: Addisu Z. Taddese <[email protected]>

* Update bazel files

Signed-off-by: Michael Carroll <[email protected]>

* Lint

Signed-off-by: Michael Carroll <[email protected]>

* Add utils back to parser

Signed-off-by: Michael Carroll <[email protected]>

* Fix gz_TEST

Signed-off-by: Michael Carroll <[email protected]>

* Ignore pycache folders

Signed-off-by: Michael Carroll <[email protected]>

* Fix parser_TEST

Signed-off-by: Michael Carroll <[email protected]>

* Bazel nits

Signed-off-by: Michael Carroll <[email protected]>

* Fix path logic

Signed-off-by: Michael Carroll <[email protected]>

* Fix visibility

Signed-off-by: Michael Carroll <[email protected]>

* Fix strings

Signed-off-by: Michael Carroll <[email protected]>

* Use standard vars

Signed-off-by: Michael Carroll <[email protected]>

* Fix string conversions

Signed-off-by: Michael Carroll <[email protected]>

* Fix string conversions

Signed-off-by: Michael Carroll <[email protected]>

* Fix embedded sdf

Signed-off-by: Michael Carroll <[email protected]>

* Fix converter test

Signed-off-by: Michael Carroll <[email protected]>

* Lint

Signed-off-by: Michael Carroll <[email protected]>

* Update bazel files

Signed-off-by: Michael Carroll <[email protected]>

* Add detail prefix

Signed-off-by: Michael Carroll <[email protected]>

* Fix test path

Signed-off-by: Michael Carroll <[email protected]>

* Set homepath on Windows

Signed-off-by: Michael Carroll <[email protected]>

---------

Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Co-authored-by: Bi0T1N <[email protected]>
Co-authored-by: Bi0T1N <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants