- # FIXME: refactor stupid OK stuff
- ok = not self.ly_is_outdated ()
- if global_options.format in (HTML, TEXINFO):
- ok = ok and os.path.exists (base + '.eps')
-
- page_count = 0
- if ok:
- page_count = ps_page_count (base + '.eps')
-
- if page_count <= 1:
- ok = ok and os.path.exists (base + '.png')
-
- elif page_count > 1:
- for a in range (1, page_count + 1):
- ok = ok and os.path.exists (base + '-page%d.png' % a)
-
- return not ok
+ eps_file = find_file (base + '.eps', raise_error=False)
+ png_file = find_file (base + '.png', raise_error=False)
+ if not self.ly_is_outdated () and global_options.format in (HTML, TEXINFO):
+ if os.path.exists (eps_file):
+ page_count = ps_page_count (eps_file)
+ if page_count <= 1:
+ return not os.path.exists (png_file)
+ else:
+ return not reduce (operator.or_,
+ [find_file (base + '-page%d.png' % a, raise_error=False)
+ for a in range (1, page_count + 1)])
+ return True