Skip to content

Instantly share code, notes, and snippets.

@ahcode0919
Created June 21, 2018 23:17
Show Gist options
  • Save ahcode0919/e4008340222e99fd6c14494b26585215 to your computer and use it in GitHub Desktop.
Save ahcode0919/e4008340222e99fd6c14494b26585215 to your computer and use it in GitHub Desktop.
Check all python file in current directory tree for compilation
import compileall
import os
import sys
# Get path of this file's directory
directory = os.path.dirname(os.path.realpath(__file__))
# Check that files are compileable
success = compileall.compile_dir(dir=directory, maxlevels=20, force=True)
# Return appropriate exit code
sys.exit(0) if success else sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment