{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/ds2/pulls/comments/208422295","pull_request_review_id":144227411,"id":208422295,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODQyMjI5NQ==","diff_hunk":"@@ -0,0 +1,98 @@\n+#!/usr/bin/env python3\n+##\n+## Copyright (c) 2014-present, Facebook, Inc.\n+## All rights reserved.\n+##\n+## This source code is licensed under the University of Illinois/NCSA Open\n+## Source License found in the LICENSE file in the root directory of this\n+## source tree. An additional grant of patent rights can be found in the\n+## PATENTS file in the same directory.\n+##\n+\n+import sys\n+import argparse\n+from typing import Any\n+import urllib.request\n+import zipfile\n+import os\n+import shutil\n+\n+try:\n+    import progress.bar\n+except ImportError:\n+    print(\"python3 -m pip install progress to see progress bars\")\n+\n+bar = None\n+bar_message = None\n+\n+\n+def update_progress_bar(chunk_number: int, maximum_chunks: int, total_size: int):\n+    global bar\n+    if \"progress.bar\" not in sys.modules:\n+        return\n+    if bar is None:\n+        bar = progress.bar.Bar(bar_message, max=total_size / maximum_chunks)\n+\n+    bar.next()\n+\n+\n+def unzip(source: str, destination: str):\n+    def unzip_file(zf, info, destination):\n+        dest_path = zf.extract(info.filename, path=destination)\n+\n+        perm = info.external_attr >> 16\n+        os.chmod(dest_path, perm)\n+\n+    with zipfile.ZipFile(source, \"r\") as f:\n+        global bar\n+        bar = progress.bar.Bar(bar_message, max=len(f.infolist()))\n+        for info in f.infolist():\n+            bar.next()\n+            unzip_file(f, info, destination)\n+\n+\n+def parse_arguments() -> argparse.Namespace:\n+    parser = argparse.ArgumentParser()\n+    parser.add_argument(\n+        \"--download-prefix\",\n+        help=\"the directory prefix for the ndk installation\",\n+        default=\"/tmp\",\n+    )\n+\n+    args = parser.parse_args()\n+    return args\n+\n+\n+def main():\n+    global bar_message\n+    args = parse_arguments()\n+\n+    if sys.platform == \"linux\":\n+        host = \"linux-x86_64\"\n+    elif sys.platform == \"darwin\":\n+        host = \"darwin-x86_64\"\n+    else:\n+        print(\"Uninmplemented platform: {}\".format(sys.platform))\n+        sys.exit(1)\n+\n+    ndk_version = \"r16b\"\n+    ndk_package_base = \"android-ndk-{}\".format(ndk_version)\n+    ndk_package_archive = \"{}-{}.zip\".format(ndk_package_base, host)\n+    ndk_url = \"https://dl.google.com/android/repository/{}\".format(ndk_package_archive)\n+    ndk_download_path = \"{}/{}\".format(args.download_prefix, ndk_package_archive)\n+    ndk_tmp_unzip = \"/tmp/android-ndk-unzip\"\n+    ndk_unzip_path = \"{}/android-ndk\".format(args.download_prefix)\n+\n+    bar_message = \"Downloading NDK\"\n+    urllib.request.urlretrieve(ndk_url, ndk_download_path, update_progress_bar)\n+    bar.finish()\n+\n+    bar_message = \"Unzipping NDK\"","path":"Support/Scripts/prepare-android-ndk.py","position":90,"original_position":90,"commit_id":"1a726b1bfae1e7541898cd88a4cda3addf91f155","original_commit_id":"1a726b1bfae1e7541898cd88a4cda3addf91f155","user":{"login":"sas","id":51052,"node_id":"MDQ6VXNlcjUxMDUy","avatar_url":"https://avatars0.githubusercontent.com/u/51052?v=4","gravatar_id":"","url":"https://api.github.com/users/sas","html_url":"https://github.com/sas","followers_url":"https://api.github.com/users/sas/followers","following_url":"https://api.github.com/users/sas/following{/other_user}","gists_url":"https://api.github.com/users/sas/gists{/gist_id}","starred_url":"https://api.github.com/users/sas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sas/subscriptions","organizations_url":"https://api.github.com/users/sas/orgs","repos_url":"https://api.github.com/users/sas/repos","events_url":"https://api.github.com/users/sas/events{/privacy}","received_events_url":"https://api.github.com/users/sas/received_events","type":"User","site_admin":false},"body":"I don't think this will get updated because there isn't any call to `update_progress_bar()` after `urlretrieve()` completes.","created_at":"2018-08-08T00:09:16Z","updated_at":"2018-08-08T00:10:21Z","html_url":"https://github.com/facebook/ds2/pull/663#discussion_r208422295","pull_request_url":"https://api.github.com/repos/facebook/ds2/pulls/663","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/facebook/ds2/pulls/comments/208422295"},"html":{"href":"https://github.com/facebook/ds2/pull/663#discussion_r208422295"},"pull_request":{"href":"https://api.github.com/repos/facebook/ds2/pulls/663"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/ds2/pulls/663","id":206577353,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2NTc3MzUz","html_url":"https://github.com/facebook/ds2/pull/663","diff_url":"https://github.com/facebook/ds2/pull/663.diff","patch_url":"https://github.com/facebook/ds2/pull/663.patch","issue_url":"https://api.github.com/repos/facebook/ds2/issues/663","number":663,"state":"open","locked":false,"title":"[WIP] Rewrite prepare-android-ndk in python 3.5","user":{"login":"lanza","id":12656790,"node_id":"MDQ6VXNlcjEyNjU2Nzkw","avatar_url":"https://avatars3.githubusercontent.com/u/12656790?v=4","gravatar_id":"","url":"https://api.github.com/users/lanza","html_url":"https://github.com/lanza","followers_url":"https://api.github.com/users/lanza/followers","following_url":"https://api.github.com/users/lanza/following{/other_user}","gists_url":"https://api.github.com/users/lanza/gists{/gist_id}","starred_url":"https://api.github.com/users/lanza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanza/subscriptions","organizations_url":"https://api.github.com/users/lanza/orgs","repos_url":"https://api.github.com/users/lanza/repos","events_url":"https://api.github.com/users/lanza/events{/privacy}","received_events_url":"https://api.github.com/users/lanza/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-07T04:33:46Z","updated_at":"2018-08-08T00:10:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d2938d2db99e0f3aab379f8d97edbb31027b9bd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":328538477,"node_id":"MDU6TGFiZWwzMjg1Mzg0Nzc=","url":"https://api.github.com/repos/facebook/ds2/labels/CLA%20Signed","name":"CLA Signed","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/ds2/pulls/663/commits","review_comments_url":"https://api.github.com/repos/facebook/ds2/pulls/663/comments","review_comment_url":"https://api.github.com/repos/facebook/ds2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/ds2/issues/663/comments","statuses_url":"https://api.github.com/repos/facebook/ds2/statuses/1a726b1bfae1e7541898cd88a4cda3addf91f155","head":{"label":"lanza:python/prepare-android-ndk","ref":"python/prepare-android-ndk","sha":"1a726b1bfae1e7541898cd88a4cda3addf91f155","user":{"login":"lanza","id":12656790,"node_id":"MDQ6VXNlcjEyNjU2Nzkw","avatar_url":"https://avatars3.githubusercontent.com/u/12656790?v=4","gravatar_id":"","url":"https://api.github.com/users/lanza","html_url":"https://github.com/lanza","followers_url":"https://api.github.com/users/lanza/followers","following_url":"https://api.github.com/users/lanza/following{/other_user}","gists_url":"https://api.github.com/users/lanza/gists{/gist_id}","starred_url":"https://api.github.com/users/lanza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanza/subscriptions","organizations_url":"https://api.github.com/users/lanza/orgs","repos_url":"https://api.github.com/users/lanza/repos","events_url":"https://api.github.com/users/lanza/events{/privacy}","received_events_url":"https://api.github.com/users/lanza/received_events","type":"User","site_admin":false},"repo":{"id":132063531,"node_id":"MDEwOlJlcG9zaXRvcnkxMzIwNjM1MzE=","name":"ds2","full_name":"lanza/ds2","owner":{"login":"lanza","id":12656790,"node_id":"MDQ6VXNlcjEyNjU2Nzkw","avatar_url":"https://avatars3.githubusercontent.com/u/12656790?v=4","gravatar_id":"","url":"https://api.github.com/users/lanza","html_url":"https://github.com/lanza","followers_url":"https://api.github.com/users/lanza/followers","following_url":"https://api.github.com/users/lanza/following{/other_user}","gists_url":"https://api.github.com/users/lanza/gists{/gist_id}","starred_url":"https://api.github.com/users/lanza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanza/subscriptions","organizations_url":"https://api.github.com/users/lanza/orgs","repos_url":"https://api.github.com/users/lanza/repos","events_url":"https://api.github.com/users/lanza/events{/privacy}","received_events_url":"https://api.github.com/users/lanza/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lanza/ds2","description":"Debug server for lldb.","fork":true,"url":"https://api.github.com/repos/lanza/ds2","forks_url":"https://api.github.com/repos/lanza/ds2/forks","keys_url":"https://api.github.com/repos/lanza/ds2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lanza/ds2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lanza/ds2/teams","hooks_url":"https://api.github.com/repos/lanza/ds2/hooks","issue_events_url":"https://api.github.com/repos/lanza/ds2/issues/events{/number}","events_url":"https://api.github.com/repos/lanza/ds2/events","assignees_url":"https://api.github.com/repos/lanza/ds2/assignees{/user}","branches_url":"https://api.github.com/repos/lanza/ds2/branches{/branch}","tags_url":"https://api.github.com/repos/lanza/ds2/tags","blobs_url":"https://api.github.com/repos/lanza/ds2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lanza/ds2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lanza/ds2/git/refs{/sha}","trees_url":"https://api.github.com/repos/lanza/ds2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lanza/ds2/statuses/{sha}","languages_url":"https://api.github.com/repos/lanza/ds2/languages","stargazers_url":"https://api.github.com/repos/lanza/ds2/stargazers","contributors_url":"https://api.github.com/repos/lanza/ds2/contributors","subscribers_url":"https://api.github.com/repos/lanza/ds2/subscribers","subscription_url":"https://api.github.com/repos/lanza/ds2/subscription","commits_url":"https://api.github.com/repos/lanza/ds2/commits{/sha}","git_commits_url":"https://api.github.com/repos/lanza/ds2/git/commits{/sha}","comments_url":"https://api.github.com/repos/lanza/ds2/comments{/number}","issue_comment_url":"https://api.github.com/repos/lanza/ds2/issues/comments{/number}","contents_url":"https://api.github.com/repos/lanza/ds2/contents/{+path}","compare_url":"https://api.github.com/repos/lanza/ds2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lanza/ds2/merges","archive_url":"https://api.github.com/repos/lanza/ds2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lanza/ds2/downloads","issues_url":"https://api.github.com/repos/lanza/ds2/issues{/number}","pulls_url":"https://api.github.com/repos/lanza/ds2/pulls{/number}","milestones_url":"https://api.github.com/repos/lanza/ds2/milestones{/number}","notifications_url":"https://api.github.com/repos/lanza/ds2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lanza/ds2/labels{/name}","releases_url":"https://api.github.com/repos/lanza/ds2/releases{/id}","deployments_url":"https://api.github.com/repos/lanza/ds2/deployments","created_at":"2018-05-04T00:17:22Z","updated_at":"2018-08-07T03:28:55Z","pushed_at":"2018-08-07T22:15:08Z","git_url":"git://github.com/lanza/ds2.git","ssh_url":"git@github.com:lanza/ds2.git","clone_url":"https://github.com/lanza/ds2.git","svn_url":"https://github.com/lanza/ds2","homepage":"https://github.com/facebook/ds2","size":90937,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"b34de26581ed32ea5bf1dc68551d416e5376b89e","user":{"login":"facebook","id":69631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjMx","avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":25325140,"node_id":"MDEwOlJlcG9zaXRvcnkyNTMyNTE0MA==","name":"ds2","full_name":"facebook/ds2","owner":{"login":"facebook","id":69631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjMx","avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/ds2","description":"Debug server for lldb.","fork":false,"url":"https://api.github.com/repos/facebook/ds2","forks_url":"https://api.github.com/repos/facebook/ds2/forks","keys_url":"https://api.github.com/repos/facebook/ds2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/ds2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/ds2/teams","hooks_url":"https://api.github.com/repos/facebook/ds2/hooks","issue_events_url":"https://api.github.com/repos/facebook/ds2/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/ds2/events","assignees_url":"https://api.github.com/repos/facebook/ds2/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/ds2/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/ds2/tags","blobs_url":"https://api.github.com/repos/facebook/ds2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/ds2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/ds2/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/ds2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/ds2/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/ds2/languages","stargazers_url":"https://api.github.com/repos/facebook/ds2/stargazers","contributors_url":"https://api.github.com/repos/facebook/ds2/contributors","subscribers_url":"https://api.github.com/repos/facebook/ds2/subscribers","subscription_url":"https://api.github.com/repos/facebook/ds2/subscription","commits_url":"https://api.github.com/repos/facebook/ds2/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/ds2/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/ds2/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/ds2/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/ds2/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/ds2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/ds2/merges","archive_url":"https://api.github.com/repos/facebook/ds2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/ds2/downloads","issues_url":"https://api.github.com/repos/facebook/ds2/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/ds2/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/ds2/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/ds2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/ds2/labels{/name}","releases_url":"https://api.github.com/repos/facebook/ds2/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/ds2/deployments","created_at":"2014-10-16T22:32:52Z","updated_at":"2018-08-07T03:26:55Z","pushed_at":"2018-08-07T06:28:57Z","git_url":"git://github.com/facebook/ds2.git","ssh_url":"git@github.com:facebook/ds2.git","clone_url":"https://github.com/facebook/ds2.git","svn_url":"https://github.com/facebook/ds2","homepage":"https://github.com/facebook/ds2","size":98879,"stargazers_count":217,"watchers_count":217,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":65,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":65,"open_issues":11,"watchers":217,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/ds2/pulls/663"},"html":{"href":"https://github.com/facebook/ds2/pull/663"},"issue":{"href":"https://api.github.com/repos/facebook/ds2/issues/663"},"comments":{"href":"https://api.github.com/repos/facebook/ds2/issues/663/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/ds2/pulls/663/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/ds2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/ds2/pulls/663/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/ds2/statuses/1a726b1bfae1e7541898cd88a4cda3addf91f155"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"sas"}}