[localecfg] It's ok to have a missing /etc/locale.gen for reading

This commit is contained in:
Adriaan de Groot 2022-04-19 08:25:34 +02:00
parent c8185affb9
commit 33b4fd3a20

View File

@ -17,6 +17,7 @@ import os
import re
import shutil
import libcalamares
import gettext
@ -71,8 +72,12 @@ def rewrite_locale_gen(srcfilename, destfilename, locale_conf):
# Get entire source-file contents
text = []
with open(srcfilename, "r") as gen:
text = gen.readlines()
try:
with open(srcfilename, "r") as gen:
text = gen.readlines()
except FileNotFoundError:
# That's ok, the file doesn't exist so assume empty
pass
# we want unique values, so locale_values should have 1 or 2 items
locale_values = set(locale_conf.values())