make_ot_samples_folder.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env python
  2. # Copyright 2019 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. import os
  6. import shutil
  7. import sys
  8. samples_pages = [
  9. 'xr-barebones.html',
  10. 'magic-window.html',
  11. 'teleportation.html',
  12. 'gamepad.html'
  13. ]
  14. other_pages = [
  15. 'attribution.html',
  16. 'favicon-32x32.png',
  17. 'favicon-96x96.png',
  18. 'favicon.ico',
  19. 'LICENSE.md'
  20. ]
  21. copy_folders = [
  22. 'css',
  23. 'js'
  24. ]
  25. def make_ot_samples_folder(source, dest):
  26. os.mkdir(dest)
  27. for f in samples_pages:
  28. shutil.copy(os.path.join(source, f), dest)
  29. for f in other_pages:
  30. shutil.copy(os.path.join(source, f), dest)
  31. for f in copy_folders:
  32. shutil.copytree(os.path.join(source, f), os.path.join(dest, f))
  33. shutil.copy(
  34. os.path.join(source, 'index.published.html'),
  35. os.path.join(dest, 'index.html'))
  36. shutil.make_archive('source', 'zip', dest)
  37. shutil.move('source.zip', dest)
  38. # media folder won't be included in the zip file or uploaded in any way as
  39. # part of this process
  40. shutil.copytree(os.path.join(source, 'media'), os.path.join(dest, 'media'))
  41. def main():
  42. make_ot_samples_folder(sys.argv[1], sys.argv[2])
  43. if __name__ == '__main__':
  44. main()