OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # coding: utf-8 |
| 3 |
| 4 import os, sys, subprocess, tempfile; |
| 5 baseDir = os.path.abspath(os.path.dirname(__file__)) |
| 6 |
| 7 def check_curl(): |
| 8 (fd, name) = tempfile.mkstemp(dir=os.path.join(baseDir, 'build'), suffix='.h') |
| 9 try: |
| 10 handle = os.fdopen(fd, 'wb'); |
| 11 handle.write('#include <curl/curl.h>') |
| 12 handle.close(); |
| 13 |
| 14 # This command won't work for Windows or Android build environments but we |
| 15 # don't want to use curl there anyway |
| 16 command = ['/usr/bin/env', 'gcc', '-E', name]; |
| 17 process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subproces
s.PIPE) |
| 18 process.communicate() |
| 19 |
| 20 if process.returncode: |
| 21 # call failed, curl not available |
| 22 sys.stdout.write('0') |
| 23 else: |
| 24 # call succeeded, curl can be used |
| 25 sys.stdout.write('1') |
| 26 finally: |
| 27 os.remove(name) |
| 28 |
| 29 if __name__ == '__main__': |
| 30 check_curl() |
OLD | NEW |