Пример #1
0
    def files_or_settings_have_changed(self) -> bool:
        database_name = self.database_name

        # Deal with legacy hash files.  We can kill off this code when
        # enough time has passed since April 2020 that we're not
        # worried about anomalies doing `git bisect`--probably a few
        # months is sufficient.
        legacy_status_dir = os.path.join(UUID_VAR_DIR,
                                         database_name + '_db_status')
        if os.path.exists(legacy_status_dir):
            print(VERBOSE_MESSAGE_ABOUT_HASH_TRANSITION)

            # Remove the old digest for several reasons:
            #   - tidiness
            #   - preventing false positives if you bisect
            #   - make this only a one-time headache (generally)
            shutil.rmtree(legacy_status_dir)

            # Return True to force a one-time rebuild.
            return True

        return is_digest_obsolete(
            self.digest_name,
            IMPORTANT_FILES,
            self.important_settings(),
        )
Пример #2
0
def need_to_run_inline_email_css() -> bool:
    if not os.path.exists('templates/zerver/emails/compiled/'):
        return True

    return is_digest_obsolete(
        "last_email_source_files_hash",
        inline_email_css_paths(),
    )
Пример #3
0
def need_to_run_build_pygments_data() -> bool:
    if not os.path.exists("static/generated/pygments_data.json"):
        return True

    return is_digest_obsolete(
        "build_pygments_data_hash",
        build_pygments_data_paths(),
        [pygments_version],
    )
Пример #4
0
def need_to_run_compilemessages() -> bool:
    if not os.path.exists('locale/language_name_map.json'):
        # User may have cleaned their git checkout.
        print('Need to run compilemessages due to missing language_name_map.json')
        return True

    return is_digest_obsolete(
        "last_compilemessages_hash",
        compilemessages_paths(),
    )
Пример #5
0
def need_to_run_configure_rabbitmq(settings_list: List[str]) -> bool:
    obsolete = is_digest_obsolete('last_configure_rabbitmq_hash',
                                  configure_rabbitmq_paths(), settings_list)

    if obsolete:
        return True

    try:
        from zerver.lib.queue import SimpleQueueClient
        SimpleQueueClient()
        return False
    except Exception:
        return True
Пример #6
0
 def is_migration_digest_obsolete(self) -> bool:
     return is_digest_obsolete(
         self.migration_digest_file,
         migration_paths(),
     )