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

Unified 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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/AdblockPlus/WebRequest.h » ('j') | include/AdblockPlus/WebRequest.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: check_curl.py
===================================================================
new file mode 100644
--- /dev/null
+++ b/check_curl.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+import os, sys, subprocess, tempfile;
+baseDir = os.path.abspath(os.path.dirname(__file__))
+
+def check_curl():
+ (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
+ try:
+ handle = os.fdopen(fd, 'wb');
+ handle.write('#include <curl/curl.h>')
+ handle.close();
+
+ # This command won't work for Windows or Android build environments but we
+ # don't want to use curl there anyway
+ command = ['/usr/bin/env', 'gcc', '-E', name];
+ process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ process.communicate()
+
+ if process.returncode:
+ # call failed, curl not available
+ sys.stdout.write('0')
+ else:
+ # call succeeded, curl can be used
+ sys.stdout.write('1')
+ finally:
+ os.remove(name)
+
+if __name__ == '__main__':
+ check_curl()
« 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