Browse Source

Build the python requests library

Cheng Zhao 9 years ago
parent
commit
89b22db618
4 changed files with 17 additions and 1 deletions
  1. 3 0
      .gitmodules
  2. 7 1
      script/bootstrap.py
  3. 6 0
      script/lib/github.py
  4. 1 0
      vendor/requests

+ 3 - 0
.gitmodules

@@ -16,3 +16,6 @@
 [submodule "vendor/crashpad"]
 	path = vendor/crashpad
 	url = https://github.com/atom/crashpad.git
+[submodule "vendor/requests"]
+	path = vendor/requests
+	url = https://github.com/kennethreitz/requests

+ 7 - 1
script/bootstrap.py

@@ -37,6 +37,7 @@ def main():
     update_clang()
 
   update_submodules()
+  setup_requests()
   update_node_modules('.')
   bootstrap_brightray(args.dev, args.url, args.target_arch)
 
@@ -84,6 +85,11 @@ def update_submodules():
   execute_stdout(['git', 'submodule', 'update', '--init', '--recursive'])
 
 
+def setup_requests():
+  with scoped_cwd(os.path.join(VENDOR_DIR, 'requests')):
+    execute_stdout([sys.executable, 'setup.py', 'build'])
+
+
 def bootstrap_brightray(is_dev, url, target_arch):
   bootstrap = os.path.join(VENDOR_DIR, 'brightray', 'script', 'bootstrap')
   args = [
@@ -109,7 +115,7 @@ def update_node_modules(dirname, env=None):
   with scoped_cwd(dirname):
     args = [NPM, 'install']
     if is_verbose_mode():
-      args += '--verbose'
+      args += ['--verbose']
     # Ignore npm install errors when running in CI.
     if os.environ.has_key('CI'):
       try:

+ 6 - 0
script/lib/github.py

@@ -1,7 +1,13 @@
 #!/usr/bin/env python
 
 import json
+import os
 import re
+import sys
+
+sys.path.append(os.path.abspath(os.path.join(__file__, '..', '..', '..',
+                                             'vendor', 'requests', 'build',
+                                             'lib')))
 import requests
 
 GITHUB_URL = 'https://api.github.com'

+ 1 - 0
vendor/requests

@@ -0,0 +1 @@
+Subproject commit e4d59bedfd3c7f4f254f4f5d036587bcd8152458