2
0

build_samples.py 773 B

1234567891011121314151617181920212223242526272829303132
  1. import os
  2. import subprocess
  3. import sys
  4. import tempfile
  5. SAMPLES_TO_BUILD = [
  6. 'asteroids',
  7. ]
  8. SAMPLES_DIR = os.path.join(os.path.dirname(__file__), '..', 'samples')
  9. def main():
  10. build_base = tempfile.TemporaryDirectory()
  11. dist_dir = tempfile.TemporaryDirectory()
  12. for sample in SAMPLES_TO_BUILD:
  13. sampledir = os.path.join(SAMPLES_DIR, sample)
  14. os.chdir(sampledir)
  15. args = [
  16. sys.executable,
  17. 'setup.py',
  18. 'bdist_apps',
  19. '--build-base', build_base.name,
  20. '--dist-dir', dist_dir.name,
  21. ]
  22. # This will raise a CalledProcessError if the build fails, which will cause
  23. # this script to fail
  24. subprocess.check_call(args)
  25. if __name__ == '__main__':
  26. main()