View Single Post
Old 01-09-2022, 09:45 AM   #97
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,475
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
@chaley: You might want to consider a git hook that's what I use, see git_post_checkout_hook.py (you can obv skip the build part and just redo the forms.
Making git hooks work on windows seems to be impossible without installing cygwin and everything that comes with it.

Thanks for the change, but it fails with
Code:
Traceback (most recent call last):
  File "runpy.py", line 194, in _run_module_as_main
  File "runpy.py", line 87, in _run_code
  File "site.py", line 82, in <module>
  File "site.py", line 77, in main
  File "site.py", line 49, in run_entry_point
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\debug.py", line 264, in main
    calibre(['calibre'] + args[1:])
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\gui_launch.py", line 61, in calibre
    with register_with_default_programs():
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\gui_launch.py", line 42, in register_with_default_programs
    from calibre.gui2 import gprefs
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\gui2\__init__.py", line 1447, in <module>
    build_forms(os.environ['CALIBRE_DEVELOP_FROM'], check_for_migration=True)
  File "C:\CBH_Data\calibre.git\calibre_dev\src\calibre\build_forms.py", line 71, in build_forms
    gprefs.set(f'migrated_forms_to_qt{qt_major}', True)
UnboundLocalError: local variable 'gprefs' referenced before assignment
This happens because gprefs isn't imported if the env var is set. My patch (above) has one fix that works in this case.
chaley is offline   Reply With Quote