make_all_examples_cpp.py 651 B

123456789101112131415
  1. #! /usr/bin/env python
  2. # Copyright 2019 Google LLC.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. ''' Run this script to re-generate the `all_examples.cpp` file after adding or
  6. deleting example fiddles. '''
  7. import glob
  8. import os
  9. os.chdir(os.path.dirname(__file__))
  10. with open('all_examples.cpp', 'w') as o:
  11. o.write('// Copyright 2019 Google LLC.\n// Use of this source code is '
  12. 'governed by a BSD-style license that can be found in the '
  13. 'LICENSE file.\n')
  14. for path in sorted(glob.glob('../../docs/examples/*.cpp')):
  15. o.write('#include "%s"\n' % path)