{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/mozdownload/pulls/comments/23898535","id":23898535,"diff_hunk":"@@ -870,13 +870,130 @@ def platform_regex(self):\n         return PLATFORM_FRAGMENTS[self.platform]\n \n \n+class TryScraper(Scraper):\n+    \"Class to download a try build from the Mozilla server.\"\n+\n+    def __init__(self, changeset=None,\n+                 debug_build=False, *args, **kwargs):\n+\n+        self.debug_build = debug_build\n+        self.changeset = changeset\n+\n+        Scraper.__init__(self, *args, **kwargs)\n+\n+    def get_build_info(self):\n+        \"Defines additional build information\"\n+\n+        self.build_index = None\n+\n+        self.locale_build = self.locale != 'en-US'\n+        # For localized builds we do not have to retrieve the list of builds\n+        # because only the last build is available\n+        if not self.locale_build:\n+            self.builds, self.build_index = self.get_build_info_for_index(\n+                self.build_index)\n+\n+    @property\n+    def binary_regex(self):\n+        \"\"\"Return the regex for the binary\"\"\"\n+\n+        regex_base_name = r'^%(APP)s-.*\\.%(LOCALE)s\\.%(PLATFORM)s'\n+        regex_suffix = {'linux': r'.*\\.%(EXT)s$',\n+                        'linux64': r'.*\\.%(EXT)s$',\n+                        'mac': r'.*\\.%(EXT)s$',\n+                        'mac64': r'.*\\.%(EXT)s$',\n+                        'win32': r'.*(\\.installer%(STUB)s)\\.%(EXT)s$',\n+                        'win64': r'.*(\\.installer%(STUB)s)\\.%(EXT)s$'}\n+\n+        regex = regex_base_name + regex_suffix[self.platform]\n+\n+        return regex % {'APP': self.application,\n+                        'LOCALE': self.locale,\n+                        'PLATFORM': PLATFORM_FRAGMENTS[self.platform],\n+                        'STUB': '-stub' if self.is_stub_installer else '',\n+                        'EXT': self.extension}\n+\n+    def build_filename(self, binary):\n+        \"\"\"Return the proposed filename with extension for the binary\"\"\"\n+\n+        return '%(CHANGESET)s%(DEBUG)s-%(NAME)s' % {\n+            'CHANGESET': self.changeset,\n+            'DEBUG': '-debug' if self.debug_build else '',\n+            'NAME': binary}\n+\n+    @property\n+    def build_list_regex(self):\n+        \"\"\"Return the regex for the folder which contains the list of builds\"\"\"\n+\n+        return 'try-builds'\n+\n+    def detect_platform(self):\n+        \"\"\"Detect the current platform\"\"\"\n+\n+        platform = Scraper.detect_platform(self)\n+\n+        # On OS X we have to special case the platform detection code and\n+        # fallback to 64 bit builds for the en-US locale\n+        if mozinfo.os == 'mac' and self.locale == 'en-US' and \\\n+                mozinfo.bits == 64:\n+            platform = \"%s%d\" % (mozinfo.os, mozinfo.bits)\n+\n+        return platform\n+\n+    def get_build_info_for_index(self, build_index=None):\n+        url = urljoin(self.base_url, self.build_list_regex)\n+\n+        self.logger.info('Retrieving list of builds from %s' % url)\n+        parser = DirectoryParser(url, authentication=self.authentication,\n+                                 timeout=self.timeout_network)\n+        parser.entries = parser.filter('.*-%s$' % self.changeset)\n+\n+        if not parser.entries:","path":"mozdownload/scraper.py","position":82,"original_position":82,"commit_id":"24d9c1a5a76debbbf621f448c9acd21d148df3c1","original_commit_id":"24d9c1a5a76debbbf621f448c9acd21d148df3c1","user":{"login":"Nebelhom","id":2185557,"avatar_url":"https://avatars.githubusercontent.com/u/2185557?v=3","gravatar_id":"","url":"https://api.github.com/users/Nebelhom","html_url":"https://github.com/Nebelhom","followers_url":"https://api.github.com/users/Nebelhom/followers","following_url":"https://api.github.com/users/Nebelhom/following{/other_user}","gists_url":"https://api.github.com/users/Nebelhom/gists{/gist_id}","starred_url":"https://api.github.com/users/Nebelhom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nebelhom/subscriptions","organizations_url":"https://api.github.com/users/Nebelhom/orgs","repos_url":"https://api.github.com/users/Nebelhom/repos","events_url":"https://api.github.com/users/Nebelhom/events{/privacy}","received_events_url":"https://api.github.com/users/Nebelhom/received_events","type":"User","site_admin":false},"body":"Do you ever just download a `latest` build and there is a chance that the folder is empty and a `NotFoundError` may happen?\r\n\r\nIf that is the case you may want to have a look at issue #11 and its solution. I am currently implementing this for tinderbox, too, where this may happen.","created_at":"2015-02-01T15:59:41Z","updated_at":"2015-02-01T15:59:41Z","html_url":"https://github.com/mozilla/mozdownload/pull/240#discussion_r23898535","pull_request_url":"https://api.github.com/repos/mozilla/mozdownload/pulls/240","_links":{"self":{"href":"https://api.github.com/repos/mozilla/mozdownload/pulls/comments/23898535"},"html":{"href":"https://github.com/mozilla/mozdownload/pull/240#discussion_r23898535"},"pull_request":{"href":"https://api.github.com/repos/mozilla/mozdownload/pulls/240"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/mozdownload/pulls/240","id":28247916,"html_url":"https://github.com/mozilla/mozdownload/pull/240","diff_url":"https://github.com/mozilla/mozdownload/pull/240.diff","patch_url":"https://github.com/mozilla/mozdownload/pull/240.patch","issue_url":"https://api.github.com/repos/mozilla/mozdownload/issues/240","number":240,"state":"open","locked":false,"title":"Firefox try support","user":{"login":"EricRahm","id":426919,"avatar_url":"https://avatars.githubusercontent.com/u/426919?v=3","gravatar_id":"","url":"https://api.github.com/users/EricRahm","html_url":"https://github.com/EricRahm","followers_url":"https://api.github.com/users/EricRahm/followers","following_url":"https://api.github.com/users/EricRahm/following{/other_user}","gists_url":"https://api.github.com/users/EricRahm/gists{/gist_id}","starred_url":"https://api.github.com/users/EricRahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EricRahm/subscriptions","organizations_url":"https://api.github.com/users/EricRahm/orgs","repos_url":"https://api.github.com/users/EricRahm/repos","events_url":"https://api.github.com/users/EricRahm/events{/privacy}","received_events_url":"https://api.github.com/users/EricRahm/received_events","type":"User","site_admin":false},"body":"Adds support for downloading Firefox try builds. The implementation and tests are primarily based on TinderboxScraper. \r\n\r\nExample usage: |mozdownload -t try --changeset=635d76cdfe1e|\r\n\r\nThis fixes issue #239 ","created_at":"2015-01-29T02:00:56Z","updated_at":"2015-02-01T15:59:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"edffb53e3fe00c7574513328c6c5e7308aa3fce7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/mozdownload/pulls/240/commits","review_comments_url":"https://api.github.com/repos/mozilla/mozdownload/pulls/240/comments","review_comment_url":"https://api.github.com/repos/mozilla/mozdownload/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla/mozdownload/issues/240/comments","statuses_url":"https://api.github.com/repos/mozilla/mozdownload/statuses/24d9c1a5a76debbbf621f448c9acd21d148df3c1","head":{"label":"EricRahm:try_support","ref":"try_support","sha":"24d9c1a5a76debbbf621f448c9acd21d148df3c1","user":{"login":"EricRahm","id":426919,"avatar_url":"https://avatars.githubusercontent.com/u/426919?v=3","gravatar_id":"","url":"https://api.github.com/users/EricRahm","html_url":"https://github.com/EricRahm","followers_url":"https://api.github.com/users/EricRahm/followers","following_url":"https://api.github.com/users/EricRahm/following{/other_user}","gists_url":"https://api.github.com/users/EricRahm/gists{/gist_id}","starred_url":"https://api.github.com/users/EricRahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EricRahm/subscriptions","organizations_url":"https://api.github.com/users/EricRahm/orgs","repos_url":"https://api.github.com/users/EricRahm/repos","events_url":"https://api.github.com/users/EricRahm/events{/privacy}","received_events_url":"https://api.github.com/users/EricRahm/received_events","type":"User","site_admin":false},"repo":{"id":29991364,"name":"mozdownload","full_name":"EricRahm/mozdownload","owner":{"login":"EricRahm","id":426919,"avatar_url":"https://avatars.githubusercontent.com/u/426919?v=3","gravatar_id":"","url":"https://api.github.com/users/EricRahm","html_url":"https://github.com/EricRahm","followers_url":"https://api.github.com/users/EricRahm/followers","following_url":"https://api.github.com/users/EricRahm/following{/other_user}","gists_url":"https://api.github.com/users/EricRahm/gists{/gist_id}","starred_url":"https://api.github.com/users/EricRahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EricRahm/subscriptions","organizations_url":"https://api.github.com/users/EricRahm/orgs","repos_url":"https://api.github.com/users/EricRahm/repos","events_url":"https://api.github.com/users/EricRahm/events{/privacy}","received_events_url":"https://api.github.com/users/EricRahm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/EricRahm/mozdownload","description":"Easy to use download tool and API for different types of Firefox and Thunderbird builds","fork":true,"url":"https://api.github.com/repos/EricRahm/mozdownload","forks_url":"https://api.github.com/repos/EricRahm/mozdownload/forks","keys_url":"https://api.github.com/repos/EricRahm/mozdownload/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EricRahm/mozdownload/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EricRahm/mozdownload/teams","hooks_url":"https://api.github.com/repos/EricRahm/mozdownload/hooks","issue_events_url":"https://api.github.com/repos/EricRahm/mozdownload/issues/events{/number}","events_url":"https://api.github.com/repos/EricRahm/mozdownload/events","assignees_url":"https://api.github.com/repos/EricRahm/mozdownload/assignees{/user}","branches_url":"https://api.github.com/repos/EricRahm/mozdownload/branches{/branch}","tags_url":"https://api.github.com/repos/EricRahm/mozdownload/tags","blobs_url":"https://api.github.com/repos/EricRahm/mozdownload/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EricRahm/mozdownload/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EricRahm/mozdownload/git/refs{/sha}","trees_url":"https://api.github.com/repos/EricRahm/mozdownload/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EricRahm/mozdownload/statuses/{sha}","languages_url":"https://api.github.com/repos/EricRahm/mozdownload/languages","stargazers_url":"https://api.github.com/repos/EricRahm/mozdownload/stargazers","contributors_url":"https://api.github.com/repos/EricRahm/mozdownload/contributors","subscribers_url":"https://api.github.com/repos/EricRahm/mozdownload/subscribers","subscription_url":"https://api.github.com/repos/EricRahm/mozdownload/subscription","commits_url":"https://api.github.com/repos/EricRahm/mozdownload/commits{/sha}","git_commits_url":"https://api.github.com/repos/EricRahm/mozdownload/git/commits{/sha}","comments_url":"https://api.github.com/repos/EricRahm/mozdownload/comments{/number}","issue_comment_url":"https://api.github.com/repos/EricRahm/mozdownload/issues/comments/{number}","contents_url":"https://api.github.com/repos/EricRahm/mozdownload/contents/{+path}","compare_url":"https://api.github.com/repos/EricRahm/mozdownload/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EricRahm/mozdownload/merges","archive_url":"https://api.github.com/repos/EricRahm/mozdownload/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EricRahm/mozdownload/downloads","issues_url":"https://api.github.com/repos/EricRahm/mozdownload/issues{/number}","pulls_url":"https://api.github.com/repos/EricRahm/mozdownload/pulls{/number}","milestones_url":"https://api.github.com/repos/EricRahm/mozdownload/milestones{/number}","notifications_url":"https://api.github.com/repos/EricRahm/mozdownload/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EricRahm/mozdownload/labels{/name}","releases_url":"https://api.github.com/repos/EricRahm/mozdownload/releases{/id}","created_at":"2015-01-28T22:21:24Z","updated_at":"2015-01-28T22:21:25Z","pushed_at":"2015-01-29T02:19:44Z","git_url":"git://github.com/EricRahm/mozdownload.git","ssh_url":"git@github.com:EricRahm/mozdownload.git","clone_url":"https://github.com/EricRahm/mozdownload.git","svn_url":"https://github.com/EricRahm/mozdownload","homepage":"http://pypi.python.org/pypi/mozdownload","size":23488,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"e102ac515b7de55ad165ae7833f25fca7d8722e9","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":4421513,"name":"mozdownload","full_name":"mozilla/mozdownload","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/mozdownload","description":"Easy to use download tool and API for different types of Firefox and Thunderbird builds","fork":false,"url":"https://api.github.com/repos/mozilla/mozdownload","forks_url":"https://api.github.com/repos/mozilla/mozdownload/forks","keys_url":"https://api.github.com/repos/mozilla/mozdownload/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/mozdownload/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/mozdownload/teams","hooks_url":"https://api.github.com/repos/mozilla/mozdownload/hooks","issue_events_url":"https://api.github.com/repos/mozilla/mozdownload/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/mozdownload/events","assignees_url":"https://api.github.com/repos/mozilla/mozdownload/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/mozdownload/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/mozdownload/tags","blobs_url":"https://api.github.com/repos/mozilla/mozdownload/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/mozdownload/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/mozdownload/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/mozdownload/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/mozdownload/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/mozdownload/languages","stargazers_url":"https://api.github.com/repos/mozilla/mozdownload/stargazers","contributors_url":"https://api.github.com/repos/mozilla/mozdownload/contributors","subscribers_url":"https://api.github.com/repos/mozilla/mozdownload/subscribers","subscription_url":"https://api.github.com/repos/mozilla/mozdownload/subscription","commits_url":"https://api.github.com/repos/mozilla/mozdownload/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/mozdownload/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/mozdownload/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/mozdownload/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/mozdownload/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/mozdownload/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/mozdownload/merges","archive_url":"https://api.github.com/repos/mozilla/mozdownload/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/mozdownload/downloads","issues_url":"https://api.github.com/repos/mozilla/mozdownload/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/mozdownload/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/mozdownload/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/mozdownload/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/mozdownload/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/mozdownload/releases{/id}","created_at":"2012-05-23T15:06:09Z","updated_at":"2015-01-16T18:04:21Z","pushed_at":"2015-01-16T18:04:19Z","git_url":"git://github.com/mozilla/mozdownload.git","ssh_url":"git@github.com:mozilla/mozdownload.git","clone_url":"https://github.com/mozilla/mozdownload.git","svn_url":"https://github.com/mozilla/mozdownload","homepage":"http://pypi.python.org/pypi/mozdownload","size":23488,"stargazers_count":21,"watchers_count":21,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":49,"forks":23,"open_issues":49,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/mozdownload/pulls/240"},"html":{"href":"https://github.com/mozilla/mozdownload/pull/240"},"issue":{"href":"https://api.github.com/repos/mozilla/mozdownload/issues/240"},"comments":{"href":"https://api.github.com/repos/mozilla/mozdownload/issues/240/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/mozdownload/pulls/240/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/mozdownload/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla/mozdownload/pulls/240/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/mozdownload/statuses/24d9c1a5a76debbbf621f448c9acd21d148df3c1"}}}}