Exemple #1
0
    def _check(self):
        """
        Determine the necessary actions for the font,
        returning a dictionary with boolean values
        """

        # shortcut
        r = self._actions

        # download archive if
        # - font not declared locally
        # - remote is newer
        # - archive is missing locally
        r['download'] = False
        if not Config.local():
            r['download'] = True if (self._local_version == '0' or
                                 self._remote_newer() or
                                 not self._archive_present()) else False

        # extract archive if
        # - it (a new one) was downloaded
        # - the archive is present but not the target font directory
        r['extract'] = True if (r['download'] or
                                (self._archive_present() and not
                                    self._font_dir_present())) else False

        # the font is considered up to date if
        # - it doesn't have to be downloaded or extracted
        # - the font repo matches the links in the installation
        if (r['download'] or r['extract']):
            r['update_links'] = Config.lilypond_font_roots()
        else:
            r['update_links'] = []
            for l in Config.lilypond_font_roots():
                if not self._check_links(l):
                    r['update_links'].append(l)

        self._up_to_date = False if (r['download'] or
            r['extract'] or
            r['update_links']) else True