Skip to content

Instantly share code, notes, and snippets.

@YuOhara
Created September 25, 2015 06:49
Show Gist options
  • Save YuOhara/3d52147d7bba1d3f35df to your computer and use it in GitHub Desktop.
Save YuOhara/3d52147d7bba1d3f35df to your computer and use it in GitHub Desktop.
#!/bin/sh
echo '--- package_temp.py 2015-09-24 22:59:13.596048340 +0900
+++ packages.py 2015-09-24 23:03:21.928045874 +0900
@@ -92,7 +92,7 @@
raise RuntimeError('\n'.join(duplicates))
return packages
-
+find_packages_allowing_duplicates_cache = dict()
def find_packages_allowing_duplicates(basepath, exclude_paths=None, exclude_subspaces=False, warnings=None):
"""
Crawls the filesystem to find package manifest files and parses them.
@@ -104,10 +104,15 @@
:param warnings: Print warnings if None or return them in the given list
:returns: A dict mapping relative paths to ``Package`` objects ``dict``
"""
+ global find_packages_allowing_duplicates_cache
+ cache_key = (basepath, exclude_paths, exclude_subspaces)
+ if cache_key in find_packages_allowing_duplicates_cache:
+ return find_packages_allowing_duplicates_cache[cache_key]
packages = {}
package_paths = find_package_paths(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces)
for path in package_paths:
packages[path] = parse_package(os.path.join(basepath, path), warnings=warnings)
+ find_packages_allowing_duplicates_cache[cache_key] = packages
return packages
' | sudo patch -u /usr/lib/python2.7/dist-packages/catkin_pkg/packages.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment