Advertisement
Guest User

Untitled

a guest
Aug 4th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. # Copyright (C) 2016 jeremy.rosen@smile.fr
  2. TEMPLATE_FILES ??=""
  3.  
  4. python template_do_template() {
  5. template_list = d.getVar('TEMPLATE_FILES', True).split()
  6.  
  7. for template in template_list:
  8. local = template
  9.  
  10.  
  11. bb.note("Applying template '%s'" % (template))
  12. try:
  13. with open(template, 'r') as f:
  14. body = f.read()
  15. except (IOError, OSError) as exc:
  16. bb.fatal(str(exc))
  17.  
  18. expanded_body = d.expand(body)
  19. bb.warn("\n%s\n\n%s" %(body,expanded_body))
  20.  
  21. try:
  22. with open(template, 'w') as f:
  23. f.write(expanded_body)
  24. except (IOError, OSError) as exc:
  25. bb.fatal(str(exc))
  26.  
  27. }
  28.  
  29. addtask template after do_patch before do_build
  30. do_template[dirs] = "${WORKDIR}"
  31.  
  32. EXPORT_FUNCTIONS do_template
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement