Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: check_curl.py

Issue 10252013: Implemented curl support for web requests (Closed)
Patch Set: Unbitrotted the patch Created April 11, 2013, 4:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/AdblockPlus/WebRequest.h » ('j') | include/AdblockPlus/WebRequest.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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')
Felix Dahlke 2013/04/12 03:53:50 This won't work for a fresh clone, as the build di
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()
OLDNEW
« no previous file with comments | « no previous file | include/AdblockPlus/WebRequest.h » ('j') | include/AdblockPlus/WebRequest.h » ('J')

Powered by Google App Engine
This is Rietveld