tls.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env python
  2. import json
  3. import urllib2
  4. import sys
  5. def check_tls(verbose):
  6. response = json.load(urllib2.urlopen('https://www.howsmyssl.com/a/check'))
  7. tls = response['tls_version']
  8. if sys.platform == "linux" or sys.platform == "linux2":
  9. tutorial = "./docs/development/build-instructions-linux.md"
  10. elif sys.platform == "darwin":
  11. tutorial = "./docs/development/build-instructions-osx.md"
  12. elif sys.platform == "win32":
  13. tutorial = "./docs/development/build-instructions-windows.md"
  14. else:
  15. tutorial = "build instructions for your operating system" \
  16. + "in ./docs/development/"
  17. if tls == "TLS 1.0":
  18. print "Your system/python combination is using an outdated security" \
  19. + "protocol and will not be able to compile Electron. Please see " \
  20. + tutorial + "." \
  21. + "for instructions on how to update Python."
  22. sys.exit(1)
  23. else:
  24. if verbose:
  25. print "Your Python is using " + tls + ", which is sufficient for" \
  26. + "building Electron."
  27. if __name__ == '__main__':
  28. check_tls(True)
  29. sys.exit(0)