1 Star 0 Fork 23

guyu/anaconda

forked from src-anolis-os/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0002-install-localization.patch 7.27 KB
一键复制 编辑 原始数据 按行查看 历史
From cb44bb47d12fcb58b159120a672d0bfaf0eacbfb Mon Sep 17 00:00:00 2001
From: pangqing <pangqing@uniontech.com>
Date: Thu, 2 Jun 2022 15:33:42 +0800
Subject: [PATCH] install localization
---
pyanaconda/core/constants.py | 2 +-
pyanaconda/modules/timezone/installation.py | 4 ++--
pyanaconda/modules/timezone/timezone.py | 2 +-
pyanaconda/ui/gui/spokes/datetime_spoke.py | 2 +-
tests/gui/date_time.py | 2 +-
tests/gui/summary.py | 2 +-
tests/nosetests/pyanaconda_tests/localization_test.py | 2 +-
.../nosetests/pyanaconda_tests/module_timezone_test.py | 10 +++++-----
8 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py
index 67510e5..b4a9c4d 100644
--- a/pyanaconda/core/constants.py
+++ b/pyanaconda/core/constants.py
@@ -77,7 +77,7 @@ ANACONDA_CONFIG_DIR = "/etc/anaconda/"
ANACONDA_CONFIG_TMP = "/run/anaconda/anaconda.conf"
# NOTE: this should be LANG_TERRITORY.CODESET, e.g. en_US.UTF-8
-DEFAULT_LANG = "en_US.UTF-8"
+DEFAULT_LANG = "zh_CN.UTF-8"
DEFAULT_VC_FONT = "eurlatgr"
diff --git a/pyanaconda/modules/timezone/installation.py b/pyanaconda/modules/timezone/installation.py
index 829748c..3856747 100644
--- a/pyanaconda/modules/timezone/installation.py
+++ b/pyanaconda/modules/timezone/installation.py
@@ -63,8 +63,8 @@ class ConfigureTimezoneTask(Task):
if not is_valid_timezone(self._timezone):
# this should never happen, but for pity's sake
log.warning("Timezone %s set in kickstart is not valid, "
- "falling back to default (America/New_York).", self._timezone)
- self._timezone = "America/New_York"
+ "falling back to default (Asia/Shanghai).", self._timezone)
+ self._timezone = "Asia/Shanghai"
def _make_timezone_symlink(self):
"""Create the symlink that actually defines timezone."""
diff --git a/pyanaconda/modules/timezone/timezone.py b/pyanaconda/modules/timezone/timezone.py
index b0fedc4..4e57a8a 100644
--- a/pyanaconda/modules/timezone/timezone.py
+++ b/pyanaconda/modules/timezone/timezone.py
@@ -39,7 +39,7 @@ class TimezoneService(KickstartService):
def __init__(self):
super().__init__()
self.timezone_changed = Signal()
- self._timezone = "America/New_York"
+ self._timezone = "Asia/Shanghai"
self.is_utc_changed = Signal()
self._is_utc = False
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index 50ae156..f6b8e06 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -66,7 +66,7 @@ SERVER_POOL = 1
SERVER_WORKING = 2
SERVER_USE = 3
-DEFAULT_TZ = "America/New_York"
+DEFAULT_TZ = "Asia/Shanghai"
SPLIT_NUMBER_SUFFIX_RE = re.compile(r'([^0-9]*)([-+])([0-9]+)')
diff --git a/tests/gui/date_time.py b/tests/gui/date_time.py
index c204ffa..1592eba 100644
--- a/tests/gui/date_time.py
+++ b/tests/gui/date_time.py
@@ -24,7 +24,7 @@ class DateTimeTestCase(UITestCase):
entry = self.find("City", "text")
self.assertIsNotNone(entry, "City entry does not exist")
- self.assertEqual(entry.text, "New York", msg="City should be set to default")
+ self.assertEqual(entry.text, "Shanghai", msg="City should be set to default")
def check_ntp(self, spoke):
# NTP should be enabled given that we started up with networking.
diff --git a/tests/gui/summary.py b/tests/gui/summary.py
index 702c2f2..f9d0f64 100644
--- a/tests/gui/summary.py
+++ b/tests/gui/summary.py
@@ -57,7 +57,7 @@ class SummaryTestCase(UITestCase):
# FIXME: This encodes default information.
for selector in selectors:
if selector.name == "TIME & DATE":
- self.assertEqual(selector.description, "Americas/New York timezone")
+ self.assertEqual(selector.description, "Asia/Shanghai timezone")
elif selector.name == "KEYBOARD":
self.assertEqual(selector.description, "English (US)")
elif selector.name == "LANGUAGE SUPPORT":
diff --git a/tests/nosetests/pyanaconda_tests/localization_test.py b/tests/nosetests/pyanaconda_tests/localization_test.py
index e44fd8a..dcecc51 100644
--- a/tests/nosetests/pyanaconda_tests/localization_test.py
+++ b/tests/nosetests/pyanaconda_tests/localization_test.py
@@ -85,7 +85,7 @@ class LangcodeLocaleParsingTests(unittest.TestCase):
localization.os.environ["LANG"] = "blah"
self.assertRaises(localization.InvalidLocaleSpec,
localization.get_xlated_timezone,
- "America/New_York")
+ "Asia/Shanghai")
class SetupLocaleTest(unittest.TestCase):
diff --git a/tests/nosetests/pyanaconda_tests/module_timezone_test.py b/tests/nosetests/pyanaconda_tests/module_timezone_test.py
index bb39bdf..80d7599 100644
--- a/tests/nosetests/pyanaconda_tests/module_timezone_test.py
+++ b/tests/nosetests/pyanaconda_tests/module_timezone_test.py
@@ -88,7 +88,7 @@ class TimezoneInterfaceTestCase(unittest.TestCase):
ks_in = None
ks_out = """
# System timezone
- timezone America/New_York
+ timezone Asia/Shanghai
"""
self._test_kickstart(ks_in, ks_out)
@@ -160,7 +160,7 @@ class TimezoneInterfaceTestCase(unittest.TestCase):
# ConfigureTimezoneTask
obj = task_objs[0]
- self.assertEqual(obj.implementation._timezone, "America/New_York")
+ self.assertEqual(obj.implementation._timezone, "Asia/Shanghai")
self.assertEqual(obj.implementation._is_utc, False)
# ConfigureNTPTask
obj = task_objs[1]
@@ -238,19 +238,19 @@ class TimezoneTasksTestCase(unittest.TestCase):
input_isutc=True,
make_adjtime=True,
make_zoneinfo=True,
- expected_symlink="../usr/share/zoneinfo/America/New_York",
+ expected_symlink="../usr/share/zoneinfo/Asia/Shanghai",
expected_adjtime_last_line="UTC")
self._test_timezone_inputs(input_zone="BahBlah",
input_isutc=True,
make_adjtime=True,
make_zoneinfo=True,
- expected_symlink="../usr/share/zoneinfo/America/New_York",
+ expected_symlink="../usr/share/zoneinfo/Asia/Shanghai",
expected_adjtime_last_line="UTC")
self._test_timezone_inputs(input_zone=None,
input_isutc=True,
make_adjtime=True,
make_zoneinfo=True,
- expected_symlink="../usr/share/zoneinfo/America/New_York",
+ expected_symlink="../usr/share/zoneinfo/Asia/Shanghai",
expected_adjtime_last_line="UTC")
@patch('pyanaconda.modules.timezone.installation.arch.is_s390', return_value=True)
--
2.18.4
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/guyvwang/anaconda.git
git@gitee.com:guyvwang/anaconda.git
guyvwang
anaconda
anaconda
a8

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385