bundle.py 822 B

12345678910111213141516171819202122
  1. import os
  2. def onbundle(unit, *args):
  3. """
  4. @usage BUNDLE(<Dir [NAME Name]>...)
  5. Brings build artefact from module Dir under optional Name to the current module (e.g. UNION)
  6. If NAME is not specified, the name of the Dir's build artefact will be preserved
  7. It makes little sense to specify BUNDLE on non-final targets and so this may stop working without prior notice.
  8. Bundle on multimodule will select final target among multimodule variants and will fail if there are none or more than one.
  9. """
  10. i = 0
  11. while i < len(args):
  12. if i + 2 < len(args) and args[i + 1] == "NAME":
  13. target, name = args[i], args[i + 2]
  14. i += 3
  15. else:
  16. target, name = args[i], os.path.basename(args[i])
  17. i += 1
  18. unit.on_bundle_target([target, name])