Fix for new CALIBRE_FORCE_BUILD_UI_FORMS environment variable causing exception because of a missing import.

This commit is contained in:
Charles Haley 2022-01-09 14:59:34 +00:00
parent 4a3bb3ac93
commit a42caf4532

View File

@ -43,9 +43,9 @@ def build_forms(srcdir, info=None, summary=False, check_for_migration=False):
# Ensure that people running from source have all their forms rebuilt for # Ensure that people running from source have all their forms rebuilt for
# the qt5 migration # the qt5 migration
force_compile = os.environ.get('CALIBRE_FORCE_BUILD_UI_FORMS', '') in ('1', 'yes', 'true') force_compile = os.environ.get('CALIBRE_FORCE_BUILD_UI_FORMS', '') in ('1', 'yes', 'true')
if check_for_migration and not force_compile: if check_for_migration:
from calibre.gui2 import gprefs from calibre.gui2 import gprefs
force_compile = not gprefs.get(f'migrated_forms_to_qt{qt_major}', False) force_compile |= not gprefs.get(f'migrated_forms_to_qt{qt_major}', False)
for form in forms: for form in forms:
compiled_form = form_to_compiled_form(form) compiled_form = form_to_compiled_form(form)
@ -67,5 +67,5 @@ def build_forms(srcdir, info=None, summary=False, check_for_migration=False):
num += 1 num += 1
if num: if num:
info('Compiled %d forms' % num) info('Compiled %d forms' % num)
if force_compile: if check_for_migration and force_compile:
gprefs.set(f'migrated_forms_to_qt{qt_major}', True) gprefs.set(f'migrated_forms_to_qt{qt_major}', True)