diff --git a/mozdownload/scraper.py b/mozdownload/scraper.py index a5896697..e31f067e 100755 --- a/mozdownload/scraper.py +++ b/mozdownload/scraper.py @@ -974,41 +974,42 @@ def get_build_info_for_index(self, build_index=None): """Get additional information for the build at the given index.""" url = urljoin(self.base_url, self.build_list_regex) - self.logger.info('Retrieving list of builds from %s' % url) - parser = self._create_directory_parser(url) - parser.entries = parser.filter(r'^\d+$') - if self.timestamp: # If a timestamp is given, retrieve the folder with the timestamp # as name - parser.entries = self.timestamp in parser.entries and \ - [self.timestamp] + entries = [self.timestamp] + else: + self.logger.info('Retrieving list of builds from %s' % url) + parser = self._create_directory_parser(url) + parser.entries = parser.filter(r'^\d+$') - elif self.date: - # If date is given, retrieve the subset of builds on that date - parser.entries = list(filter(self.date_matches, parser.entries)) + if self.date: + # If date is given, retrieve the subset of builds on that date + parser.entries = list(filter(self.date_matches, parser.entries)) - if not parser.entries: - message = 'No builds have been found' - raise errors.NotFoundError(message, url) + if not parser.entries: + message = 'No builds have been found' + raise errors.NotFoundError(message, url) - self.show_matching_builds(parser.entries) + entries = parser.entries + + self.show_matching_builds(entries) # If no index has been given, set it to the last build of the day. if build_index is None: # Find the most recent non-empty entry. - build_index = len(parser.entries) - for build in reversed(parser.entries): + build_index = len(entries) + for build in reversed(entries): build_index -= 1 if not build_index or self.is_build_dir(build): break - if build_index >= len(parser.entries): + if build_index >= len(entries): raise errors.NotFoundError('Specified build number has not been found ', url) - self.logger.info('Selected build: %s' % parser.entries[build_index]) + self.logger.info('Selected build: %s' % entries[build_index]) - return (parser.entries, build_index) + return (entries, build_index) @property def path_regex(self):