[Merge] ~gunnarhj/ubuntu-release-upgrader:temp-font into ubuntu-release-upgrader:ubuntu/main
Nick Rosbrook
mp+451815 at code.launchpad.net
Thu Sep 21 20:18:20 UTC 2023
Review: Needs Fixing
Please see inline comments.
Diff comments:
> diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
> index 0bd1ef9..609177d 100644
> --- a/DistUpgrade/DistUpgradeQuirks.py
> +++ b/DistUpgrade/DistUpgradeQuirks.py
> @@ -1336,6 +1338,40 @@ class DistUpgradeQuirks(object):
> boot_config_filename, failure_action)
> return
>
> + def _set_generic_font(self):
> + """ Due to changes to the Ubuntu font we enable a generic font
> + (in practice DejaVu or Noto) during the upgrade.
> + See https://launchpad.net/bugs/2034986
> + """
> + if subprocess.run(['gsettings', 'writable', 'org.gnome.desktop.interface', 'font-name'],
If this is not true, it would be good to log a message explaining that this quirk won't be executed. Please also log messages if any other subprocess calls fail.
> + capture_output=True, text=True).stdout == "true\n":
> +
> + # store user font-name
> + userfont = subprocess.run(['gsettings', 'get', 'org.gnome.desktop.interface', 'font-name'],
> + capture_output=True, text=True).stdout
> + f = open('/tmp/orig_user_font.txt', 'w')
Why write this to a temp file? Why not just use an attribute like `self._original_font` or something?
> + f.write(userfont)
> + f.close()
> +
> + # set generic sans-serif font
> + m = re.search(r'\d+', userfont)
> + size = (m and m.group() or '11')
> + subprocess.run(['gsettings', 'set', 'org.gnome.desktop.interface', 'font-name', 'Sans '+size])
> +
> + def _back_to_original_font(self):
> + """ This funcion resets it to the user's original font after
> + the temporary change in _set_generic_font().
> + """
> + orig_font = '/tmp/orig_user_font.txt'
> + if os.path.isfile(orig_font):
> + f = open(orig_font, 'r')
> + userfont = f.read()
> + f.close()
> + os.remove(orig_font)
> +
> + # back to user's original font
> + subprocess.run(['gsettings', 'set', 'org.gnome.desktop.interface', 'font-name', userfont])
> +
> def replace_uboot(lines):
> result = []
> removed_uboot = added_kernel = False
--
https://code.launchpad.net/~gunnarhj/ubuntu-release-upgrader/+git/ubuntu-release-upgrader/+merge/451815
Your team Ubuntu Core Development Team is requested to review the proposed merge of ~gunnarhj/ubuntu-release-upgrader:temp-font into ubuntu-release-upgrader:ubuntu/main.
More information about the Ubuntu-reviews
mailing list