diff options
| -rw-r--r-- | meta/lib/oe/package.py | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index b8585d4253..dd700cbb0c 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py | |||
| @@ -283,36 +283,3 @@ def read_shlib_providers(d): | |||
| 283 | shlib_provider[s[0]] = {} | 283 | shlib_provider[s[0]] = {} |
| 284 | shlib_provider[s[0]][s[1]] = (dep_pkg, s[2]) | 284 | shlib_provider[s[0]][s[1]] = (dep_pkg, s[2]) |
| 285 | return shlib_provider | 285 | return shlib_provider |
| 286 | |||
| 287 | |||
| 288 | def npm_split_package_dirs(pkgdir): | ||
| 289 | """ | ||
| 290 | Work out the packages fetched and unpacked by BitBake's npm fetcher | ||
| 291 | Returns a dict of packagename -> (relpath, package.json) ordered | ||
| 292 | such that it is suitable for use in PACKAGES and FILES | ||
| 293 | """ | ||
| 294 | from collections import OrderedDict | ||
| 295 | import json | ||
| 296 | packages = {} | ||
| 297 | for root, dirs, files in os.walk(pkgdir): | ||
| 298 | if os.path.basename(root) == 'node_modules': | ||
| 299 | for dn in dirs: | ||
| 300 | relpth = os.path.relpath(os.path.join(root, dn), pkgdir) | ||
| 301 | pkgitems = ['${PN}'] | ||
| 302 | for pathitem in relpth.split('/'): | ||
| 303 | if pathitem == 'node_modules': | ||
| 304 | continue | ||
| 305 | pkgitems.append(pathitem) | ||
| 306 | pkgname = '-'.join(pkgitems).replace('_', '-') | ||
| 307 | pkgname = pkgname.replace('@', '') | ||
| 308 | pkgfile = os.path.join(root, dn, 'package.json') | ||
| 309 | data = None | ||
| 310 | if os.path.exists(pkgfile): | ||
| 311 | with open(pkgfile, 'r') as f: | ||
| 312 | data = json.loads(f.read()) | ||
| 313 | packages[pkgname] = (relpth, data) | ||
| 314 | # We want the main package for a module sorted *after* its subpackages | ||
| 315 | # (so that it doesn't otherwise steal the files for the subpackage), so | ||
| 316 | # this is a cheap way to do that whilst still having an otherwise | ||
| 317 | # alphabetical sort | ||
| 318 | return OrderedDict((key, packages[key]) for key in sorted(packages, key=lambda pkg: pkg + '~')) | ||
