libv8 5.3.332.38.5 → 5.6.326.50.0beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.md +2 -0
  4. data/ext/libv8/builder.rb +2 -2
  5. data/lib/libv8/version.rb +1 -1
  6. data/patches/0001-Build-a-standalone-static-library.patch +4 -4
  7. data/patches/0002-Don-t-compile-unnecessary-stuff.patch +16 -11
  8. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +4 -4
  9. data/patches/{0005-Do-not-embed-debug-symbols-in-macOS-libraries.patch → 0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch} +4 -4
  10. data/vendor/depot_tools/.gitignore +4 -0
  11. data/vendor/depot_tools/OWNERS +0 -2
  12. data/vendor/depot_tools/PRESUBMIT.py +20 -23
  13. data/vendor/depot_tools/README.gclient.md +3 -3
  14. data/vendor/depot_tools/README.git-cl.md +13 -12
  15. data/vendor/depot_tools/README.md +2 -3
  16. data/vendor/depot_tools/WATCHLISTS +0 -1
  17. data/vendor/depot_tools/appengine_mapper.py +23 -0
  18. data/vendor/depot_tools/apply_issue.py +2 -8
  19. data/vendor/depot_tools/bootstrap/win/README.md +1 -8
  20. data/vendor/depot_tools/bootstrap/win/git_bootstrap.py +6 -16
  21. data/vendor/depot_tools/bootstrap/win/git_version.txt +1 -1
  22. data/vendor/depot_tools/bootstrap/win/git_version_bleeding_edge.txt +1 -1
  23. data/vendor/depot_tools/checkout.py +20 -433
  24. data/vendor/depot_tools/cipd +73 -0
  25. data/vendor/depot_tools/cipd.bat +12 -0
  26. data/vendor/depot_tools/cipd.ps1 +57 -0
  27. data/vendor/depot_tools/cipd_client_version +1 -0
  28. data/vendor/depot_tools/clang_format.py +9 -6
  29. data/vendor/depot_tools/clang_format_merge_driver +8 -0
  30. data/vendor/depot_tools/clang_format_merge_driver.bat +11 -0
  31. data/vendor/depot_tools/clang_format_merge_driver.py +67 -0
  32. data/vendor/depot_tools/codereview.settings +3 -2
  33. data/vendor/depot_tools/commit_queue.py +1 -1
  34. data/vendor/depot_tools/cpplint.py +2 -0
  35. data/vendor/depot_tools/fetch.py +1 -54
  36. data/vendor/depot_tools/fetch_configs/android.py +2 -2
  37. data/vendor/depot_tools/fetch_configs/breakpad.py +2 -3
  38. data/vendor/depot_tools/fetch_configs/chromium.py +2 -3
  39. data/vendor/depot_tools/fetch_configs/crashpad.py +2 -2
  40. data/vendor/depot_tools/fetch_configs/dart.py +2 -3
  41. data/vendor/depot_tools/fetch_configs/dartino.py +2 -3
  42. data/vendor/depot_tools/fetch_configs/dartium.py +2 -3
  43. data/vendor/depot_tools/fetch_configs/depot_tools.py +3 -6
  44. data/vendor/depot_tools/fetch_configs/gyp.py +2 -3
  45. data/vendor/depot_tools/fetch_configs/infra.py +2 -2
  46. data/vendor/depot_tools/fetch_configs/infra_internal.py +2 -2
  47. data/vendor/depot_tools/fetch_configs/ios.py +2 -2
  48. data/vendor/depot_tools/fetch_configs/ios_internal.py +2 -3
  49. data/vendor/depot_tools/fetch_configs/mojo.py +2 -3
  50. data/vendor/depot_tools/fetch_configs/nacl.py +2 -3
  51. data/vendor/depot_tools/fetch_configs/naclports.py +2 -3
  52. data/vendor/depot_tools/fetch_configs/pdfium.py +2 -2
  53. data/vendor/depot_tools/fetch_configs/skia.py +2 -2
  54. data/vendor/depot_tools/fetch_configs/skia_buildbot.py +2 -2
  55. data/vendor/depot_tools/fetch_configs/syzygy.py +2 -2
  56. data/vendor/depot_tools/fetch_configs/v8.py +2 -3
  57. data/vendor/depot_tools/fetch_configs/webrtc.py +5 -3
  58. data/vendor/depot_tools/fetch_configs/webrtc_android.py +2 -2
  59. data/vendor/depot_tools/fetch_configs/webrtc_ios.py +2 -2
  60. data/vendor/depot_tools/fix_encoding.py +6 -6
  61. data/vendor/depot_tools/gclient.py +136 -368
  62. data/vendor/depot_tools/gclient_scm.py +108 -647
  63. data/vendor/depot_tools/gclient_utils.py +22 -86
  64. data/vendor/depot_tools/gerrit_client.py +105 -0
  65. data/vendor/depot_tools/gerrit_util.py +174 -67
  66. data/vendor/depot_tools/git-crrev-parse +6 -7
  67. data/vendor/depot_tools/git-gs +1 -1
  68. data/vendor/depot_tools/git_cache.py +68 -18
  69. data/vendor/depot_tools/git_cherry_pick_upload.py +4 -4
  70. data/vendor/depot_tools/git_cl.py +1028 -961
  71. data/vendor/depot_tools/git_common.py +2 -3
  72. data/vendor/depot_tools/git_drover.py +0 -1
  73. data/vendor/depot_tools/git_footers.py +3 -43
  74. data/vendor/depot_tools/git_rebase_update.py +9 -1
  75. data/vendor/depot_tools/git_squash_branch.py +1 -1
  76. data/vendor/depot_tools/infra/config/cq.cfg +8 -1
  77. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  78. data/vendor/depot_tools/man/html/depot_tools.html +3 -11
  79. data/vendor/depot_tools/man/html/depot_tools_tutorial.html +9 -9
  80. data/vendor/depot_tools/man/html/git-cherry-pick-upload.html +2 -2
  81. data/vendor/depot_tools/man/html/git-drover.html +17 -17
  82. data/vendor/depot_tools/man/html/git-footers.html +2 -2
  83. data/vendor/depot_tools/man/html/git-freeze.html +4 -4
  84. data/vendor/depot_tools/man/html/git-hyper-blame.html +2 -2
  85. data/vendor/depot_tools/man/html/git-map-branches.html +2 -2
  86. data/vendor/depot_tools/man/html/git-map.html +2 -2
  87. data/vendor/depot_tools/man/html/git-mark-merge-base.html +2 -2
  88. data/vendor/depot_tools/man/html/git-nav-downstream.html +2 -2
  89. data/vendor/depot_tools/man/html/git-nav-upstream.html +2 -2
  90. data/vendor/depot_tools/man/html/git-new-branch.html +2 -2
  91. data/vendor/depot_tools/man/html/git-rebase-update.html +2 -2
  92. data/vendor/depot_tools/man/html/git-rename-branch.html +2 -2
  93. data/vendor/depot_tools/man/html/git-reparent-branch.html +2 -2
  94. data/vendor/depot_tools/man/html/git-retry.html +3 -3
  95. data/vendor/depot_tools/man/html/git-squash-branch.html +3 -3
  96. data/vendor/depot_tools/man/html/git-thaw.html +2 -2
  97. data/vendor/depot_tools/man/html/git-upstream-diff.html +3 -3
  98. data/vendor/depot_tools/man/man1/git-cherry-pick-upload.1 +4 -4
  99. data/vendor/depot_tools/man/man1/git-drover.1 +19 -19
  100. data/vendor/depot_tools/man/man1/git-footers.1 +4 -4
  101. data/vendor/depot_tools/man/man1/git-freeze.1 +6 -6
  102. data/vendor/depot_tools/man/man1/git-hyper-blame.1 +4 -4
  103. data/vendor/depot_tools/man/man1/git-map-branches.1 +4 -4
  104. data/vendor/depot_tools/man/man1/git-map.1 +4 -4
  105. data/vendor/depot_tools/man/man1/git-mark-merge-base.1 +4 -4
  106. data/vendor/depot_tools/man/man1/git-nav-downstream.1 +4 -4
  107. data/vendor/depot_tools/man/man1/git-nav-upstream.1 +4 -4
  108. data/vendor/depot_tools/man/man1/git-new-branch.1 +4 -4
  109. data/vendor/depot_tools/man/man1/git-rebase-update.1 +4 -4
  110. data/vendor/depot_tools/man/man1/git-rename-branch.1 +4 -4
  111. data/vendor/depot_tools/man/man1/git-reparent-branch.1 +4 -4
  112. data/vendor/depot_tools/man/man1/git-retry.1 +5 -5
  113. data/vendor/depot_tools/man/man1/git-squash-branch.1 +5 -5
  114. data/vendor/depot_tools/man/man1/git-thaw.1 +4 -4
  115. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +5 -5
  116. data/vendor/depot_tools/man/man7/depot_tools.7 +5 -10
  117. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +4 -4
  118. data/vendor/depot_tools/man/src/depot_tools.txt +1 -1
  119. data/vendor/depot_tools/man/src/depot_tools_tutorial.txt +7 -7
  120. data/vendor/depot_tools/man/src/filter_demo_output.py +2 -2
  121. data/vendor/depot_tools/man/src/git-footers.demo.1.sh +1 -1
  122. data/vendor/depot_tools/man/src/git-retry.txt +1 -1
  123. data/vendor/depot_tools/man/src/git-squash-branch.txt +2 -2
  124. data/vendor/depot_tools/man/src/git-upstream-diff.txt +1 -1
  125. data/vendor/depot_tools/my_activity.py +6 -3
  126. data/vendor/depot_tools/my_reviews.py +1 -1
  127. data/vendor/depot_tools/ninja +2 -2
  128. data/vendor/depot_tools/ninja-linux32 +0 -0
  129. data/vendor/depot_tools/ninja-linux64 +0 -0
  130. data/vendor/depot_tools/ninja-mac +0 -0
  131. data/vendor/depot_tools/ninja.exe +0 -0
  132. data/vendor/depot_tools/owners.py +14 -3
  133. data/vendor/depot_tools/presubmit_canned_checks.py +46 -67
  134. data/vendor/depot_tools/presubmit_support.py +109 -371
  135. data/vendor/depot_tools/pylintrc +83 -56
  136. data/vendor/depot_tools/recipe_modules/OWNERS +1 -0
  137. data/vendor/depot_tools/recipe_modules/bot_update/__init__.py +18 -9
  138. data/vendor/depot_tools/recipe_modules/bot_update/api.py +56 -55
  139. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic.json +3 -7
  140. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic_output_manifest.json +3 -7
  141. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic_with_branch_heads.json +3 -7
  142. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/buildbot.json +52 -0
  143. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/clobber.json +19 -10
  144. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/gerrit_no_rebase_patch_ref.json +19 -10
  145. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/gerrit_no_reset.json +19 -10
  146. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/no_shallow.json +19 -10
  147. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/reset_root_solution_revision.json +19 -10
  148. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange.json +3 -7
  149. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange_oauth2.json +2 -54
  150. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange_oauth2_buildbot.json +56 -0
  151. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/{forced.json → trychange_oauth2_json.json} +6 -9
  152. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange_oauth2_json_win.json +54 -0
  153. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob.json +9 -9
  154. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail.json +9 -9
  155. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json +9 -9
  156. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json +9 -9
  157. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle.json +20 -10
  158. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle_deprecated.json +59 -0
  159. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_v8.json +9 -9
  160. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_v8_head_by_default.json +20 -10
  161. data/vendor/depot_tools/recipe_modules/bot_update/example.py +45 -63
  162. data/vendor/depot_tools/recipe_modules/bot_update/resources/bot_update.py +210 -807
  163. data/vendor/depot_tools/recipe_modules/bot_update/test_api.py +34 -45
  164. data/vendor/depot_tools/recipe_modules/cipd/api.py +59 -84
  165. data/vendor/depot_tools/recipe_modules/cipd/example.expected/basic.json +71 -117
  166. data/vendor/depot_tools/recipe_modules/cipd/example.expected/describe-failed.json +14 -60
  167. data/vendor/depot_tools/recipe_modules/cipd/example.expected/describe-many-instances.json +71 -117
  168. data/vendor/depot_tools/recipe_modules/cipd/example.expected/mac64.json +71 -117
  169. data/vendor/depot_tools/recipe_modules/cipd/example.expected/win64.json +71 -117
  170. data/vendor/depot_tools/recipe_modules/cipd/example.py +2 -12
  171. data/vendor/depot_tools/recipe_modules/cipd/test_api.py +0 -9
  172. data/vendor/depot_tools/recipe_modules/depot_tools/api.py +6 -0
  173. data/vendor/depot_tools/recipe_modules/depot_tools/example.expected/basic.json +7 -0
  174. data/vendor/depot_tools/recipe_modules/depot_tools/example.expected/win.json +7 -0
  175. data/vendor/depot_tools/recipe_modules/depot_tools/example.py +3 -0
  176. data/vendor/depot_tools/recipe_modules/gclient/__init__.py +4 -0
  177. data/vendor/depot_tools/recipe_modules/gclient/api.py +9 -22
  178. data/vendor/depot_tools/recipe_modules/gclient/config.py +18 -5
  179. data/vendor/depot_tools/recipe_modules/gclient/example.expected/basic.json +14 -14
  180. data/vendor/depot_tools/recipe_modules/gclient/example.expected/buildbot.json +211 -0
  181. data/vendor/depot_tools/recipe_modules/gclient/example.expected/revision.json +16 -14
  182. data/vendor/depot_tools/recipe_modules/gclient/example.expected/tryserver.json +16 -14
  183. data/vendor/depot_tools/recipe_modules/gclient/example.py +13 -11
  184. data/vendor/depot_tools/recipe_modules/gerrit/__init__.py +6 -0
  185. data/vendor/depot_tools/recipe_modules/gerrit/api.py +63 -0
  186. data/vendor/depot_tools/recipe_modules/gerrit/example.expected/basic.json +64 -0
  187. data/vendor/depot_tools/recipe_modules/gerrit/example.py +35 -0
  188. data/vendor/depot_tools/recipe_modules/gerrit/test_api.py +24 -0
  189. data/vendor/depot_tools/recipe_modules/git/__init__.py +4 -0
  190. data/vendor/depot_tools/recipe_modules/git/api.py +155 -142
  191. data/vendor/depot_tools/recipe_modules/git/example.expected/basic.json +43 -17
  192. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_branch.json +43 -17
  193. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_file_name.json +43 -17
  194. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_hash.json +43 -17
  195. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_ref.json +43 -17
  196. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_submodule_update_force.json +43 -17
  197. data/vendor/depot_tools/recipe_modules/git/example.expected/can_fail_build.json +13 -13
  198. data/vendor/depot_tools/recipe_modules/git/example.expected/cannot_fail_build.json +43 -17
  199. data/vendor/depot_tools/recipe_modules/git/example.expected/cat-file_test.json +45 -19
  200. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_delta.json +45 -19
  201. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_failed.json +43 -17
  202. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output.json +43 -17
  203. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output_fails_build.json +8 -8
  204. data/vendor/depot_tools/recipe_modules/git/example.expected/curl_trace_file.json +44 -18
  205. data/vendor/depot_tools/recipe_modules/git/example.expected/git-cache-checkout.json +48 -22
  206. data/vendor/depot_tools/recipe_modules/git/example.expected/platform_win.json +43 -17
  207. data/vendor/depot_tools/recipe_modules/git/example.expected/rebase_failed.json +42 -16
  208. data/vendor/depot_tools/recipe_modules/git/example.expected/remote_not_origin.json +43 -17
  209. data/vendor/depot_tools/recipe_modules/git/example.expected/set_got_revision.json +43 -17
  210. data/vendor/depot_tools/recipe_modules/git/example.py +9 -3
  211. data/vendor/depot_tools/recipe_modules/git_cl/__init__.py +4 -0
  212. data/vendor/depot_tools/recipe_modules/git_cl/api.py +8 -8
  213. data/vendor/depot_tools/recipe_modules/git_cl/example.py +1 -1
  214. data/vendor/depot_tools/recipe_modules/gsutil/__init__.py +4 -0
  215. data/vendor/depot_tools/recipe_modules/gsutil/api.py +196 -0
  216. data/vendor/depot_tools/recipe_modules/gsutil/example.expected/basic.json +186 -0
  217. data/vendor/depot_tools/recipe_modules/gsutil/example.py +77 -0
  218. data/vendor/depot_tools/recipe_modules/gsutil/resources/gsutil_smart_retry.py +69 -0
  219. data/vendor/depot_tools/recipe_modules/infra_paths/__init__.py +3 -0
  220. data/vendor/depot_tools/recipe_modules/infra_paths/api.py +20 -3
  221. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/basic.json +3 -1
  222. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_linux.json +3 -1
  223. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_mac.json +3 -1
  224. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_win.json +3 -1
  225. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_linux.json +3 -1
  226. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_mac.json +3 -1
  227. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_win.json +3 -1
  228. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_linux.json +3 -1
  229. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_mac.json +3 -1
  230. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_win.json +3 -1
  231. data/vendor/depot_tools/recipe_modules/infra_paths/example.py +6 -1
  232. data/vendor/depot_tools/recipe_modules/infra_paths/path_config.py +4 -6
  233. data/vendor/depot_tools/recipe_modules/rietveld/__init__.py +5 -0
  234. data/vendor/depot_tools/recipe_modules/rietveld/api.py +12 -9
  235. data/vendor/depot_tools/recipe_modules/rietveld/example.expected/basic.json +2 -24
  236. data/vendor/depot_tools/recipe_modules/rietveld/example.expected/buildbot.json +30 -0
  237. data/vendor/depot_tools/recipe_modules/rietveld/example.py +12 -6
  238. data/vendor/depot_tools/recipe_modules/tryserver/__init__.py +4 -0
  239. data/vendor/depot_tools/recipe_modules/tryserver/api.py +46 -70
  240. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/set_failure_hash_with_no_steps.json +8 -0
  241. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/{with_svn_patch.json → with_gerrit_patch.json} +1 -31
  242. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_gerrit_patch_deprecated.json +39 -0
  243. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_git_patch.json +2 -2
  244. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_git_patch_luci.json +8 -0
  245. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch.json +3 -3
  246. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json +3 -3
  247. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch.json +1 -1
  248. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch_new.json +1 -1
  249. data/vendor/depot_tools/recipe_modules/tryserver/example.py +35 -5
  250. data/vendor/depot_tools/recipes.py +52 -28
  251. data/vendor/depot_tools/repo +216 -69
  252. data/vendor/depot_tools/rietveld.py +20 -15
  253. data/vendor/depot_tools/roll_dep.py +1 -1
  254. data/vendor/depot_tools/scm.py +11 -826
  255. data/vendor/depot_tools/subprocess2.py +5 -5
  256. data/vendor/depot_tools/third_party/cq_client/README.depot_tools.md +2 -0
  257. data/vendor/depot_tools/third_party/cq_client/README.md +5 -1
  258. data/vendor/depot_tools/third_party/cq_client/cq.pb.go +183 -104
  259. data/vendor/depot_tools/third_party/cq_client/cq.proto +43 -27
  260. data/vendor/depot_tools/third_party/cq_client/cq_pb2.py +95 -29
  261. data/vendor/depot_tools/third_party/cq_client/testdata/cq_both.cfg +67 -0
  262. data/vendor/depot_tools/third_party/cq_client/testdata/cq_gerrit.cfg +1 -2
  263. data/vendor/depot_tools/third_party/cq_client/testdata/cq_rietveld.cfg +0 -3
  264. data/vendor/depot_tools/third_party/upload.py +44 -24
  265. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +0 -5
  266. metadata +38 -93
  267. data/patches/0004-Reinterpret-thread-hash-for-FreeBSD-too.patch +0 -25
  268. data/vendor/depot_tools/git-auto-svn +0 -6
  269. data/vendor/depot_tools/git_auto_svn.py +0 -122
  270. data/vendor/depot_tools/man/html/git-auto-svn.html +0 -837
  271. data/vendor/depot_tools/man/man1/git-auto-svn.1 +0 -113
  272. data/vendor/depot_tools/man/src/_git-auto-svn_desc.helper.txt +0 -1
  273. data/vendor/depot_tools/man/src/git-auto-svn.txt +0 -69
  274. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/off.json +0 -43
  275. data/vendor/depot_tools/recipe_modules/cipd/example.expected/install-failed.json +0 -31
  276. data/vendor/depot_tools/recipe_modules/cipd/resources/bootstrap.py +0 -218
  277. data/vendor/depot_tools/recipe_modules/tryserver/test_api.py +0 -7
  278. data/vendor/depot_tools/third_party/gsutil/CHECKSUM +0 -1
  279. data/vendor/depot_tools/third_party/gsutil/COPYING +0 -202
  280. data/vendor/depot_tools/third_party/gsutil/LICENSE.third_party +0 -295
  281. data/vendor/depot_tools/third_party/gsutil/MANIFEST.in +0 -5
  282. data/vendor/depot_tools/third_party/gsutil/README +0 -38
  283. data/vendor/depot_tools/third_party/gsutil/README.chromium +0 -25
  284. data/vendor/depot_tools/third_party/gsutil/README.pkg +0 -49
  285. data/vendor/depot_tools/third_party/gsutil/ReleaseNotes.txt +0 -825
  286. data/vendor/depot_tools/third_party/gsutil/VERSION +0 -1
  287. data/vendor/depot_tools/third_party/gsutil/gslib/README +0 -5
  288. data/vendor/depot_tools/third_party/gsutil/gslib/__init__.py +0 -22
  289. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/__init__.py +0 -15
  290. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/acls.py +0 -234
  291. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/anon.py +0 -57
  292. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/command_opts.py +0 -116
  293. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/dev.py +0 -139
  294. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/metadata.py +0 -186
  295. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/naming.py +0 -173
  296. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/prod.py +0 -160
  297. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/projects.py +0 -130
  298. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/subdirs.py +0 -110
  299. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/support.py +0 -86
  300. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/versioning.py +0 -242
  301. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/wildcards.py +0 -170
  302. data/vendor/depot_tools/third_party/gsutil/gslib/bucket_listing_ref.py +0 -175
  303. data/vendor/depot_tools/third_party/gsutil/gslib/command.py +0 -725
  304. data/vendor/depot_tools/third_party/gsutil/gslib/command_runner.py +0 -102
  305. data/vendor/depot_tools/third_party/gsutil/gslib/commands/__init__.py +0 -15
  306. data/vendor/depot_tools/third_party/gsutil/gslib/commands/cat.py +0 -131
  307. data/vendor/depot_tools/third_party/gsutil/gslib/commands/chacl.py +0 -523
  308. data/vendor/depot_tools/third_party/gsutil/gslib/commands/config.py +0 -662
  309. data/vendor/depot_tools/third_party/gsutil/gslib/commands/cp.py +0 -1819
  310. data/vendor/depot_tools/third_party/gsutil/gslib/commands/disablelogging.py +0 -101
  311. data/vendor/depot_tools/third_party/gsutil/gslib/commands/enablelogging.py +0 -149
  312. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getacl.py +0 -82
  313. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getcors.py +0 -121
  314. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getdefacl.py +0 -86
  315. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getlogging.py +0 -137
  316. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getversioning.py +0 -116
  317. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getwebcfg.py +0 -122
  318. data/vendor/depot_tools/third_party/gsutil/gslib/commands/help.py +0 -218
  319. data/vendor/depot_tools/third_party/gsutil/gslib/commands/ls.py +0 -578
  320. data/vendor/depot_tools/third_party/gsutil/gslib/commands/mb.py +0 -172
  321. data/vendor/depot_tools/third_party/gsutil/gslib/commands/mv.py +0 -159
  322. data/vendor/depot_tools/third_party/gsutil/gslib/commands/perfdiag.py +0 -903
  323. data/vendor/depot_tools/third_party/gsutil/gslib/commands/rb.py +0 -113
  324. data/vendor/depot_tools/third_party/gsutil/gslib/commands/rm.py +0 -237
  325. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setacl.py +0 -138
  326. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setcors.py +0 -145
  327. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setdefacl.py +0 -105
  328. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setmeta.py +0 -420
  329. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setversioning.py +0 -114
  330. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setwebcfg.py +0 -190
  331. data/vendor/depot_tools/third_party/gsutil/gslib/commands/update.py +0 -305
  332. data/vendor/depot_tools/third_party/gsutil/gslib/commands/version.py +0 -150
  333. data/vendor/depot_tools/third_party/gsutil/gslib/exception.py +0 -76
  334. data/vendor/depot_tools/third_party/gsutil/gslib/help_provider.py +0 -81
  335. data/vendor/depot_tools/third_party/gsutil/gslib/name_expansion.py +0 -550
  336. data/vendor/depot_tools/third_party/gsutil/gslib/no_op_auth_plugin.py +0 -30
  337. data/vendor/depot_tools/third_party/gsutil/gslib/plurality_checkable_iterator.py +0 -56
  338. data/vendor/depot_tools/third_party/gsutil/gslib/project_id.py +0 -67
  339. data/vendor/depot_tools/third_party/gsutil/gslib/storage_uri_builder.py +0 -56
  340. data/vendor/depot_tools/third_party/gsutil/gslib/thread_pool.py +0 -79
  341. data/vendor/depot_tools/third_party/gsutil/gslib/util.py +0 -167
  342. data/vendor/depot_tools/third_party/gsutil/gslib/wildcard_iterator.py +0 -498
  343. data/vendor/depot_tools/third_party/gsutil/gsutil +0 -384
  344. data/vendor/depot_tools/third_party/gsutil/gsutil.spec.in +0 -75
  345. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/__init__.py +0 -22
  346. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_client.py +0 -630
  347. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_client_test.py +0 -374
  348. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_helper.py +0 -103
  349. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py +0 -24
  350. data/vendor/depot_tools/third_party/gsutil/pkg_util.py +0 -60
  351. data/vendor/depot_tools/third_party/gsutil/plugins/__init__.py +0 -0
  352. data/vendor/depot_tools/third_party/gsutil/plugins/sso_auth.py +0 -105
@@ -1,374 +0,0 @@
1
- # Copyright 2010 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- """Unit tests for oauth2_client."""
16
-
17
- import datetime
18
- import logging
19
- import os
20
- import sys
21
- import unittest
22
- import urllib2
23
- import urlparse
24
- from stat import S_IMODE
25
- from StringIO import StringIO
26
-
27
- test_bin_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
28
-
29
- lib_dir = os.path.join(test_bin_dir, '..')
30
- sys.path.insert(0, lib_dir)
31
-
32
- # Needed for boto.cacerts
33
- boto_lib_dir = os.path.join(test_bin_dir, '..', 'boto')
34
- sys.path.insert(0, boto_lib_dir)
35
-
36
- import oauth2_client
37
-
38
- LOG = logging.getLogger('oauth2_client_test')
39
-
40
- class MockOpener:
41
- def __init__(self):
42
- self.reset()
43
-
44
- def reset(self):
45
- self.open_error = None
46
- self.open_result = None
47
- self.open_capture_url = None
48
- self.open_capture_data = None
49
-
50
- def open(self, req, data=None):
51
- self.open_capture_url = req.get_full_url()
52
- self.open_capture_data = req.get_data()
53
- if self.open_error is not None:
54
- raise self.open_error
55
- else:
56
- return StringIO(self.open_result)
57
-
58
-
59
- class MockDateTime:
60
- def __init__(self):
61
- self.mock_now = None
62
-
63
- def utcnow(self):
64
- return self.mock_now
65
-
66
-
67
- class OAuth2ClientTest(unittest.TestCase):
68
- def setUp(self):
69
- self.opener = MockOpener()
70
- self.mock_datetime = MockDateTime()
71
- self.start_time = datetime.datetime(2011, 3, 1, 10, 25, 13, 300826)
72
- self.mock_datetime.mock_now = self.start_time
73
- self.client = oauth2_client.OAuth2Client(
74
- oauth2_client.OAuth2Provider(
75
- 'Sample OAuth Provider',
76
- 'https://provider.example.com/oauth/provider?mode=authorize',
77
- 'https://provider.example.com/oauth/provider?mode=token'),
78
- 'clid', 'clsecret',
79
- url_opener=self.opener, datetime_strategy=self.mock_datetime)
80
-
81
- def testFetchAccessToken(self):
82
- refresh_token = '1/ZaBrxdPl77Bi4jbsO7x-NmATiaQZnWPB51nTvo8n9Sw'
83
- access_token = '1/aalskfja-asjwerwj'
84
- self.opener.open_result = (
85
- '{"access_token":"%s","expires_in":3600}' % access_token)
86
- cred = oauth2_client.RefreshToken(self.client, refresh_token)
87
- token = self.client.FetchAccessToken(cred)
88
-
89
- self.assertEquals(
90
- self.opener.open_capture_url,
91
- 'https://provider.example.com/oauth/provider?mode=token')
92
- self.assertEquals({
93
- 'grant_type': ['refresh_token'],
94
- 'client_id': ['clid'],
95
- 'client_secret': ['clsecret'],
96
- 'refresh_token': [refresh_token]},
97
- urlparse.parse_qs(self.opener.open_capture_data, keep_blank_values=True,
98
- strict_parsing=True))
99
- self.assertEquals(access_token, token.token)
100
- self.assertEquals(
101
- datetime.datetime(2011, 3, 1, 11, 25, 13, 300826),
102
- token.expiry)
103
-
104
- def testFetchAccessTokenFailsForBadJsonResponse(self):
105
- self.opener.open_result = 'blah'
106
- cred = oauth2_client.RefreshToken(self.client, 'abc123')
107
- self.assertRaises(
108
- oauth2_client.AccessTokenRefreshError, self.client.FetchAccessToken, cred)
109
-
110
- def testFetchAccessTokenFailsForErrorResponse(self):
111
- self.opener.open_error = urllib2.HTTPError(
112
- None, 400, 'Bad Request', None, StringIO('{"error": "invalid token"}'))
113
- cred = oauth2_client.RefreshToken(self.client, 'abc123')
114
- self.assertRaises(
115
- oauth2_client.AccessTokenRefreshError, self.client.FetchAccessToken, cred)
116
-
117
- def testFetchAccessTokenFailsForHttpError(self):
118
- self.opener.open_result = urllib2.HTTPError(
119
- 'foo', 400, 'Bad Request', None, None)
120
- cred = oauth2_client.RefreshToken(self.client, 'abc123')
121
- self.assertRaises(
122
- oauth2_client.AccessTokenRefreshError, self.client.FetchAccessToken, cred)
123
-
124
- def testGetAccessToken(self):
125
- refresh_token = 'ref_token'
126
- access_token_1 = 'abc123'
127
- self.opener.open_result = (
128
- '{"access_token":"%s",' '"expires_in":3600}' % access_token_1)
129
- cred = oauth2_client.RefreshToken(self.client, refresh_token)
130
-
131
- token_1 = self.client.GetAccessToken(cred)
132
-
133
- # There's no access token in the cache; verify that we fetched a fresh
134
- # token.
135
- self.assertEquals({
136
- 'grant_type': ['refresh_token'],
137
- 'client_id': ['clid'],
138
- 'client_secret': ['clsecret'],
139
- 'refresh_token': [refresh_token]},
140
- urlparse.parse_qs(self.opener.open_capture_data, keep_blank_values=True,
141
- strict_parsing=True))
142
- self.assertEquals(access_token_1, token_1.token)
143
- self.assertEquals(self.start_time + datetime.timedelta(minutes=60),
144
- token_1.expiry)
145
-
146
- # Advance time by less than expiry time, and fetch another token.
147
- self.opener.reset()
148
- self.mock_datetime.mock_now = (
149
- self.start_time + datetime.timedelta(minutes=55))
150
- token_2 = self.client.GetAccessToken(cred)
151
-
152
- # Since the access token wasn't expired, we get the cache token, and there
153
- # was no refresh request.
154
- self.assertEquals(token_1, token_2)
155
- self.assertEquals(access_token_1, token_2.token)
156
- self.assertEquals(None, self.opener.open_capture_url)
157
- self.assertEquals(None, self.opener.open_capture_data)
158
-
159
- # Advance time past expiry time, and fetch another token.
160
- self.opener.reset()
161
- self.mock_datetime.mock_now = (
162
- self.start_time + datetime.timedelta(minutes=55, seconds=1))
163
- access_token_2 = 'zyx456'
164
- self.opener.open_result = (
165
- '{"access_token":"%s",' '"expires_in":3600}' % access_token_2)
166
- token_3 = self.client.GetAccessToken(cred)
167
-
168
- # This should have resulted in a refresh request and a fresh access token.
169
- self.assertEquals({
170
- 'grant_type': ['refresh_token'],
171
- 'client_id': ['clid'],
172
- 'client_secret': ['clsecret'],
173
- 'refresh_token': [refresh_token]},
174
- urlparse.parse_qs(self.opener.open_capture_data, keep_blank_values=True,
175
- strict_parsing=True))
176
- self.assertEquals(access_token_2, token_3.token)
177
- self.assertEquals(self.mock_datetime.mock_now + datetime.timedelta(minutes=60),
178
- token_3.expiry)
179
-
180
- def testGetAuthorizationUri(self):
181
- authn_uri = self.client.GetAuthorizationUri(
182
- 'https://www.example.com/oauth/redir?mode=approve%20me',
183
- ('scope_foo', 'scope_bar'),
184
- {'state': 'this and that & sundry'})
185
-
186
- uri_parts = urlparse.urlsplit(authn_uri)
187
- self.assertEquals(('https', 'provider.example.com', '/oauth/provider'),
188
- uri_parts[:3])
189
-
190
- self.assertEquals({
191
- 'response_type': ['code'],
192
- 'client_id': ['clid'],
193
- 'redirect_uri':
194
- ['https://www.example.com/oauth/redir?mode=approve%20me'],
195
- 'scope': ['scope_foo scope_bar'],
196
- 'state': ['this and that & sundry'],
197
- 'mode': ['authorize']},
198
- urlparse.parse_qs(uri_parts[3]))
199
-
200
- def testExchangeAuthorizationCode(self):
201
- code = 'codeABQ1234'
202
- exp_refresh_token = 'ref_token42'
203
- exp_access_token = 'access_tokenXY123'
204
- self.opener.open_result = (
205
- '{"access_token":"%s","expires_in":3600,"refresh_token":"%s"}'
206
- % (exp_access_token, exp_refresh_token))
207
-
208
- refresh_token, access_token = self.client.ExchangeAuthorizationCode(
209
- code, 'urn:ietf:wg:oauth:2.0:oob', ('scope1', 'scope2'))
210
-
211
- self.assertEquals({
212
- 'grant_type': ['authorization_code'],
213
- 'client_id': ['clid'],
214
- 'client_secret': ['clsecret'],
215
- 'code': [code],
216
- 'redirect_uri': ['urn:ietf:wg:oauth:2.0:oob'],
217
- 'scope': ['scope1 scope2'] },
218
- urlparse.parse_qs(self.opener.open_capture_data, keep_blank_values=True,
219
- strict_parsing=True))
220
- self.assertEquals(exp_access_token, access_token.token)
221
- self.assertEquals(self.start_time + datetime.timedelta(minutes=60),
222
- access_token.expiry)
223
-
224
- self.assertEquals(self.client, refresh_token.oauth2_client)
225
- self.assertEquals(exp_refresh_token, refresh_token.refresh_token)
226
-
227
- # Check that the access token was put in the cache.
228
- cached_token = self.client.access_token_cache.GetToken(
229
- refresh_token.CacheKey())
230
- self.assertEquals(access_token, cached_token)
231
-
232
-
233
- class AccessTokenTest(unittest.TestCase):
234
-
235
- def testShouldRefresh(self):
236
- mock_datetime = MockDateTime()
237
- start = datetime.datetime(2011, 3, 1, 11, 25, 13, 300826)
238
- expiry = start + datetime.timedelta(minutes=60)
239
- token = oauth2_client.AccessToken(
240
- 'foo', expiry, datetime_strategy=mock_datetime)
241
-
242
- mock_datetime.mock_now = start
243
- self.assertFalse(token.ShouldRefresh())
244
-
245
- mock_datetime.mock_now = start + datetime.timedelta(minutes=54)
246
- self.assertFalse(token.ShouldRefresh())
247
-
248
- mock_datetime.mock_now = start + datetime.timedelta(minutes=55)
249
- self.assertFalse(token.ShouldRefresh())
250
-
251
- mock_datetime.mock_now = start + datetime.timedelta(
252
- minutes=55, seconds=1)
253
- self.assertTrue(token.ShouldRefresh())
254
-
255
- mock_datetime.mock_now = start + datetime.timedelta(
256
- minutes=61)
257
- self.assertTrue(token.ShouldRefresh())
258
-
259
- mock_datetime.mock_now = start + datetime.timedelta(minutes=58)
260
- self.assertFalse(token.ShouldRefresh(time_delta=120))
261
-
262
- mock_datetime.mock_now = start + datetime.timedelta(
263
- minutes=58, seconds=1)
264
- self.assertTrue(token.ShouldRefresh(time_delta=120))
265
-
266
- def testShouldRefreshNoExpiry(self):
267
- mock_datetime = MockDateTime()
268
- start = datetime.datetime(2011, 3, 1, 11, 25, 13, 300826)
269
- token = oauth2_client.AccessToken(
270
- 'foo', None, datetime_strategy=mock_datetime)
271
-
272
- mock_datetime.mock_now = start
273
- self.assertFalse(token.ShouldRefresh())
274
-
275
- mock_datetime.mock_now = start + datetime.timedelta(
276
- minutes=472)
277
- self.assertFalse(token.ShouldRefresh())
278
-
279
- def testSerialization(self):
280
- expiry = datetime.datetime(2011, 3, 1, 11, 25, 13, 300826)
281
- token = oauth2_client.AccessToken('foo', expiry)
282
- serialized_token = token.Serialize()
283
- LOG.debug('testSerialization: serialized_token=%s' % serialized_token)
284
-
285
- token2 = oauth2_client.AccessToken.UnSerialize(serialized_token)
286
- self.assertEquals(token, token2)
287
-
288
-
289
- class RefreshTokenTest(unittest.TestCase):
290
- def setUp(self):
291
- self.opener = MockOpener()
292
- self.mock_datetime = MockDateTime()
293
- self.start_time = datetime.datetime(2011, 3, 1, 10, 25, 13, 300826)
294
- self.mock_datetime.mock_now = self.start_time
295
- self.client = oauth2_client.OAuth2Client(
296
- oauth2_client.OAuth2Provider(
297
- 'Sample OAuth Provider',
298
- 'https://provider.example.com/oauth/provider?mode=authorize',
299
- 'https://provider.example.com/oauth/provider?mode=token'),
300
- 'clid', 'clsecret',
301
- url_opener=self.opener, datetime_strategy=self.mock_datetime)
302
-
303
- self.cred = oauth2_client.RefreshToken(self.client, 'ref_token_abc123')
304
-
305
- def testUniqeId(self):
306
- cred_id = self.cred.CacheKey()
307
- self.assertEquals('0720afed6871f12761fbea3271f451e6ba184bf5', cred_id)
308
-
309
- def testGetAuthorizationHeader(self):
310
- access_token = 'access_123'
311
- self.opener.open_result = (
312
- '{"access_token":"%s","expires_in":3600}' % access_token)
313
-
314
- self.assertEquals('Bearer %s' % access_token,
315
- self.cred.GetAuthorizationHeader())
316
-
317
-
318
- class FileSystemTokenCacheTest(unittest.TestCase):
319
-
320
- def setUp(self):
321
- self.cache = oauth2_client.FileSystemTokenCache()
322
- self.start_time = datetime.datetime(2011, 3, 1, 10, 25, 13, 300826)
323
- self.token_1 = oauth2_client.AccessToken('token1', self.start_time)
324
- self.token_2 = oauth2_client.AccessToken(
325
- 'token2', self.start_time + datetime.timedelta(seconds=492))
326
- self.key = 'token1key'
327
-
328
- def tearDown(self):
329
- try:
330
- os.unlink(self.cache.CacheFileName(self.key))
331
- except:
332
- pass
333
-
334
- def testPut(self):
335
- self.cache.PutToken(self.key, self.token_1)
336
- # Assert that the cache file exists and has correct permissions.
337
- self.assertEquals(
338
- 0600, S_IMODE(os.stat(self.cache.CacheFileName(self.key)).st_mode))
339
-
340
- def testPutGet(self):
341
- # No cache file present.
342
- self.assertEquals(None, self.cache.GetToken(self.key))
343
-
344
- # Put a token
345
- self.cache.PutToken(self.key, self.token_1)
346
- cached_token = self.cache.GetToken(self.key)
347
- self.assertEquals(self.token_1, cached_token)
348
-
349
- # Put a different token
350
- self.cache.PutToken(self.key, self.token_2)
351
- cached_token = self.cache.GetToken(self.key)
352
- self.assertEquals(self.token_2, cached_token)
353
-
354
- def testGetBadFile(self):
355
- f = open(self.cache.CacheFileName(self.key), 'w')
356
- f.write('blah')
357
- f.close()
358
- self.assertEquals(None, self.cache.GetToken(self.key))
359
-
360
- def testCacheFileName(self):
361
- cache = oauth2_client.FileSystemTokenCache(
362
- path_pattern='/var/run/ccache/token.%(uid)s.%(key)s')
363
- self.assertEquals('/var/run/ccache/token.%d.abc123' % os.getuid(),
364
- cache.CacheFileName('abc123'))
365
-
366
- cache = oauth2_client.FileSystemTokenCache(
367
- path_pattern='/var/run/ccache/token.%(key)s')
368
- self.assertEquals('/var/run/ccache/token.abc123',
369
- cache.CacheFileName('abc123'))
370
-
371
-
372
- if __name__ == '__main__':
373
- logging.basicConfig(level=logging.DEBUG)
374
- unittest.main()
@@ -1,103 +0,0 @@
1
- # Copyright 2011 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- """Helper routines to facilitate use of oauth2_client in gsutil."""
16
-
17
- import sys
18
- import time
19
- import webbrowser
20
-
21
- import oauth2_client
22
-
23
- GSUTIL_CLIENT_ID = '909320924072.apps.googleusercontent.com'
24
- # Google OAuth2 clients always have a secret, even if the client is an installed
25
- # application/utility such as gsutil. Of course, in such cases the "secret" is
26
- # actually publicly known; security depends entirly on the secrecy of refresh
27
- # tokens, which effectively become bearer tokens.
28
- GSUTIL_CLIENT_NOTSOSECRET = 'p3RlpR10xMFh9ZXBS/ZNLYUu'
29
-
30
- GOOGLE_OAUTH2_PROVIDER_LABEL = 'Google'
31
- GOOGLE_OAUTH2_PROVIDER_AUTHORIZATION_URI = (
32
- 'https://accounts.google.com/o/oauth2/auth')
33
- GOOGLE_OAUTH2_PROVIDER_TOKEN_URI = (
34
- 'https://accounts.google.com/o/oauth2/token')
35
-
36
- OOB_REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
37
-
38
- def OAuth2ClientFromBotoConfig(config):
39
- token_cache = None
40
- token_cache_type = config.get('OAuth2', 'token_cache', 'file_system')
41
-
42
- if token_cache_type == 'file_system':
43
- if config.has_option('OAuth2', 'token_cache_path_pattern'):
44
- token_cache = oauth2_client.FileSystemTokenCache(
45
- path_pattern=config.get('OAuth2', 'token_cache_path_pattern'))
46
- else:
47
- token_cache = oauth2_client.FileSystemTokenCache()
48
- elif token_cache_type == 'in_memory':
49
- token_cache = oauth2_client.InMemoryTokenCache()
50
- else:
51
- raise Exception(
52
- "Invalid value for config option OAuth2/token_cache: %s" %
53
- token_cache_type)
54
-
55
- proxy = None
56
- if (config.has_option('Boto', 'proxy')
57
- and config.has_option('Boto', 'proxy_port')):
58
- proxy = "%s:%s" % (config.get('Boto', 'proxy'),
59
- config.get('Boto', 'proxy_port'))
60
-
61
- provider_label = config.get(
62
- 'OAuth2', 'provider_label', GOOGLE_OAUTH2_PROVIDER_LABEL)
63
- provider_authorization_uri = config.get(
64
- 'OAuth2', 'provider_authorization_uri',
65
- GOOGLE_OAUTH2_PROVIDER_AUTHORIZATION_URI)
66
- provider_token_uri = config.get(
67
- 'OAuth2', 'provider_token_uri', GOOGLE_OAUTH2_PROVIDER_TOKEN_URI)
68
-
69
- client_id = config.get('OAuth2', 'client_id', GSUTIL_CLIENT_ID)
70
- client_secret = config.get(
71
- 'OAuth2', 'client_secret', GSUTIL_CLIENT_NOTSOSECRET)
72
-
73
- return oauth2_client.OAuth2Client(
74
- oauth2_client.OAuth2Provider(
75
- provider_label, provider_authorization_uri, provider_token_uri),
76
- client_id, client_secret,
77
- proxy=proxy, access_token_cache=token_cache)
78
-
79
- def OAuth2ApprovalFlow(oauth2_client, scopes, launch_browser=False):
80
- approval_url = oauth2_client.GetAuthorizationUri(OOB_REDIRECT_URI, scopes)
81
- if launch_browser:
82
- sys.stdout.write(
83
- 'Attempting to launch a browser with the OAuth2 approval dialog at '
84
- 'URL: %s\n\n'
85
- '[Note: due to a Python bug, you may see a spurious error message "object is not\n'
86
- 'callable [...] in [...] Popen.__del__" which can be ignored.]\n\n' % approval_url)
87
- else:
88
- sys.stdout.write(
89
- 'Please navigate your browser to the following URL:\n%s\n\n' %
90
- approval_url)
91
-
92
- if (launch_browser and
93
- not webbrowser.open(approval_url, new=1, autoraise=True)):
94
- sys.stdout.write(
95
- 'Launching browser appears to have failed; please navigate a browser '
96
- 'to the following URL:\n%s\n' % approval_url)
97
- code = raw_input('Enter the authorization code: ')
98
-
99
- refresh_token, access_token = oauth2_client.ExchangeAuthorizationCode(
100
- code, OOB_REDIRECT_URI, scopes)
101
-
102
- return refresh_token
103
-