Skip to content

Commit

Permalink
Merge branch 'master' into issue-668-major-release
Browse files Browse the repository at this point in the history
  • Loading branch information
piri-p authored May 8, 2024
2 parents 10d1663 + dafc75b commit affce65
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions mozdownload/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit affce65

Please sign in to comment.