forked from ros-infrastructure/rospkg
-
Notifications
You must be signed in to change notification settings - Fork 1
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
[sw_license] Fix (#1 was not complete at all) #2
Closed
130s
wants to merge
2
commits into
por_master
from
feature-license-introspection-syspkg_basedon-por-master
Closed
[sw_license] Fix (#1 was not complete at all) #2
130s
wants to merge
2
commits into
por_master
from
feature-license-introspection-syspkg_basedon-por-master
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WIP: [get_licenses] Getting system pkg feature better to move in RosPack. Otherwise circular dependency issue between rospack and sw_license occurs. [get_rosdeps] Add testcase (address a feedback at ros-infrastructure#129 (comment)). This test is supposed to fail without patch to get_rosdeps. [RosPack.get_rosdeps] Fix returns invalid value when an existent package name passed (reported at ros-infrastructure#129 (comment)) BEFORE ``` $ env|grep -i pythonpath PYTHONPATH=/opt/ros/kinetic/lib/python2.7/dist-packages:/home/n130s/link/github_repos/130s/hut_10sqft/src:/home/n130s/link/github_repos/130s/hut_10sqft/src $ apt-cache policy python-rospkg python-rospkg: Installed: 1.1.4-100 Candidate: 1.1.4-100 Version table: *** 1.1.4-100 500 500 http://packages.ros.org/ros/ubuntu xenial/main amd64 Packages 500 http://packages.ros.org/ros/ubuntu xenial/main i386 Packages 100 /var/lib/dpkg/status $ ipython : In [1]: from rospkg import RosPack In [2]: rp = RosPack() In [3]: rp.get_rosdeps("roscpp") --------------------------------------------------------------------------- ResourceNotFound Traceback (most recent call last) : ----> 1 rp.get_rosdeps("roscpp") /usr/lib/python2.7/dist-packages/rospkg/rospack.pyc in get_rosdeps(self, package, implicit) 343 """ 344 if implicit: --> 345 return self._implicit_rosdeps(package) 346 else: 347 m = self.get_manifest(package) /usr/lib/python2.7/dist-packages/rospkg/rospack.pyc in _implicit_rosdeps(self, package) 363 364 # take the union of all dependencies --> 365 packages = self.get_depends(package, implicit=True) 366 for p in packages: 367 s.update(self.get_rosdeps(p, implicit=False)) /usr/lib/python2.7/dist-packages/rospkg/rospack.pyc in get_depends(self, name, implicit) 238 239 for p in names: --> 240 s.update(self.get_depends(p, implicit)) 241 # add in our own deps 242 s.update(names) /usr/lib/python2.7/dist-packages/rospkg/rospack.pyc in get_depends(self, name, implicit) 232 233 # take the union of all dependencies --> 234 names = [p.name for p in self.get_manifest(name).depends] 235 236 # assign key before recursive call to prevent infinite case /usr/lib/python2.7/dist-packages/rospkg/rospack.pyc in get_manifest(self, name) 165 return self._manifests[name] 166 else: --> 167 return self._load_manifest(name) 168 169 def _update_location_cache(self): /usr/lib/python2.7/dist-packages/rospkg/rospack.pyc in _load_manifest(self, name) 209 :raises: :exc:`ResourceNotFound` 210 """ --> 211 retval = self._manifests[name] = parse_manifest_file(self.get_path(name), self._manifest_name, rospack=self) 212 return retval 213 /usr/lib/python2.7/dist-packages/rospkg/rospack.pyc in get_path(self, name) 201 self._update_location_cache() 202 if name not in self._location_cache: --> 203 raise ResourceNotFound(name, ros_paths=self._ros_paths) 204 else: 205 return self._location_cache[name] ResourceNotFound: roslang ROS path [0]=/opt/ros/kinetic/share/ros ROS path [1]=/opt/ros/kinetic/share In [4]: rp.get_rosdeps("roscpp") Out[4]: set() ``` AFTER. I'm even having roslang missing, but with the fix in this commit, `get_rosdeps` returns what it was able to find. ``` $ ipython : In [1]: from rospkg import RosPack In [2]: rp = RosPack() In [3]: rp.get_rosdeps("roscpp") : Not available in your environment: roslang Out[3]: ['python-yaml', 'python-mock', 'cmake', 'tinyxml', 'python-empy', 'apr', 'python-rosdep', 'python', 'python-rospkg', 'python-catkin-pkg', 'gtest', 'python-argparse', 'python-nose', 'python-coverage', 'libconsole-bridge-dev', 'boost', 'log4cxx', 'pkg-config'] ``` [rospkg.ResourceNotFound] Add a list of dependency info that is captured before the exception occurs. Improve get_depends error message. **Issue** When some dependencies are not available on the environment you run `RosPack.get_depends`, 2 issues: - the error message doesn't mention all missing pkgs; in the example below, what missing are `roslang` and `rosunit`, but it only shows rosunit. After missing dep is somehow cleared then shows another single pkg missing on the next run. - command fails without printing the dependency. - I might be misunderstanding the purpose of `get_depends`, but what I assume as a user from the method name is that it returns the list of defined dependency. So command failing to show any list (because of some depended pkgs are not available on your particular environment) is misleading. **Solution** - Returns the list of all dependency. - Warn what's missing on your environment. Also get_depends raises exception to not break API (see ros-infrastructure#129 (comment)) [RosPack.get_depends] Fix: when unavailable pkg name is passed, 'set()' is returned. [RosPack.get_depends] Address review feedback (unnecessary exception handlings) and got it working. [sw_licenses] Small refactoring; Remove unnecessary return value. [sw_licenses] Add tests. [sw_licenses] Add tests. - Adding another test pkg, in order to preserve what's been used as it is. - For some reason the dependency isn't captured on Travis CI, so the license record file only contains the pkg itself. - To the new test pkg, add "qt4-qmake" as a depend, as its license let me find locally an issue in license comparison feature. [sw_licenses] Trying to fix import error in a test. Not sure why but this change fixed the following error. https://travis-ci.org/ros-infrastructure/rospkg/jobs/397073625 ``` ====================================================================== ERROR: test.test_rospkg_sw_licenses.test_compare_license ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/home/travis/build/ros-infrastructure/rospkg/test/test_rospkg_sw_licenses.py", line 42, in test_compare_license manager = rospkg.sw_license.LicenseUtil(ros_paths=[search_path]) AttributeError: 'module' object has no attribute 'sw_license' ``` [sw_license] Fix variable bugs. These probably got in when cherry-picking branches. [sw_licence] Not fail when new found licenses are permissive. [license] Save result into default file name when the suggested output file name is too long for the OS. [licenses] Rename folder to make it more generic
…Not sure why that was removed. Worth keeping as that maybe useful and also in case we want to add another sort option in the future.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#1 seems to have failed to capture all changes sw_license feature needed.
Conflicting with
por_master
. Locally resolve and push.Closing.