From e9e736aaf07d15eebfe24570b6ddd8badb4f8443 Mon Sep 17 00:00:00 2001 From: Wenlong Zhang Date: Fri, 2 Dec 2022 14:08:50 +0800 Subject: [PATCH] add loongarch support for pyparted Signed-off-by: Wenlong Zhang --- src/parted/__init__.py | 7 ++++--- tests/test_parted_parted.py | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/parted/__init__.py b/src/parted/__init__.py index ef049ee..c3aa070 100644 --- a/src/parted/__init__.py +++ b/src/parted/__init__.py @@ -405,7 +405,8 @@ archLabels = {'i386': ['msdos', 'gpt'], 'mips64': ['msdos','gpt'], 'armv7l': ['msdos', 'gpt'], 'riscv32': ['msdos', 'gpt'], - 'riscv64': ['msdos', 'gpt']} + 'riscv64': ['msdos', 'gpt'], + 'loongarch64': ['msdos', 'gpt']} # Adapted from: # http://stackoverflow.com/questions/922550/how-to-mark-a-global-as-deprecated-in-python @@ -442,9 +443,9 @@ def Deprecated(mod, deprecated=None): __archLabels = (('amiga', 'ppc(64)?$'), ('bsd', 'alpha$'), ('dasd', 's390x?$'), - ('gpt', 'i[3-6]86$|x86_64$|ia64$|ppc(64|64le)?$|aarch64$|armv7l$|riscv(32|64)$'), + ('gpt', 'i[3-6]86$|x86_64$|ia64$|ppc(64|64le)?$|aarch64$|armv7l$|riscv(32|64)$|loongarch64$'), ('mac', 'ppc(64)?$'), - ('msdos', 'i[3-6]86$|x86_64$|s390x?$|alpha$|ia64$|ppc(64|64le)?$|aarch64$|mips64$|armv7l$|riscv(32|64)$'), + ('msdos', 'i[3-6]86$|x86_64$|s390x?$|alpha$|ia64$|ppc(64|64le)?$|aarch64$|mips64$|armv7l$|riscv(32|64)$|loongarch64'), ('sun', 'sparc(64)?$')) def getLabels(arch=None): diff --git a/tests/test_parted_parted.py b/tests/test_parted_parted.py index c615aad..d2b9a90 100755 --- a/tests/test_parted_parted.py +++ b/tests/test_parted_parted.py @@ -65,6 +65,7 @@ class GetLabelsTestCase(unittest.TestCase): self.assertSetEqual(parted.getLabels('armv7l'), {'gpt', 'msdos'}) self.assertSetEqual(parted.getLabels('riscv32'), {'gpt', 'msdos'}) self.assertSetEqual(parted.getLabels('riscv64'), {'gpt', 'msdos'}) + self.assertSetEqual(parted.getLabels('loongarch64'), {'gpt', 'msdos'}) class GetDeviceTestCase(RequiresDeviceNode): def runTest(self): -- 2.33.0