!22 add loongarch support for pyparted

From: @zhangwenlong01 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
This commit is contained in:
openeuler-ci-bot 2022-12-06 09:40:10 +00:00 committed by Gitee
commit 9d31361eec
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,52 @@
From e9e736aaf07d15eebfe24570b6ddd8badb4f8443 Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Fri, 2 Dec 2022 14:08:50 +0800
Subject: [PATCH] add loongarch support for pyparted
Signed-off-by: Wenlong Zhang <zhangwenlong@loongson.cn>
---
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

View File

@ -1,7 +1,7 @@
Name: pyparted Name: pyparted
Epoch: 1 Epoch: 1
Version: 3.12.0 Version: 3.12.0
Release: 1 Release: 2
Summary: Python bindings for libparted Summary: Python bindings for libparted
License: GPLv2 License: GPLv2
Group: System Environment/Libraries Group: System Environment/Libraries
@ -11,6 +11,8 @@ Source0: https://github.com/dcantrell/pyparted/releases/download/v%{version}/%{n
BuildRequires: gcc pkgconfig e2fsprogs parted-devel >= 3.2-18 BuildRequires: gcc pkgconfig e2fsprogs parted-devel >= 3.2-18
BuildRequires: python3-devel python3-six BuildRequires: python3-devel python3-six
Patch001: 0001-add-loongarch-support-for-pyparted.patch
%description %description
%{name} is a set of native Python bindings for libparted. libparted is the %{name} is a set of native Python bindings for libparted. libparted is the
library portion of the GNU parted project. With pyparted, you can write library portion of the GNU parted project. With pyparted, you can write
@ -42,6 +44,9 @@ PYTHON=python3 %make_install
%{python3_sitearch}/%{name}-%{version}-*.egg-info %{python3_sitearch}/%{name}-%{version}-*.egg-info
%changelog %changelog
* Thu Dec 1 2022 Wenlong Zhang<zhangwenlong@loongson.cn> - 3.12.0-2
- Add loongarch64 architecture
* Fri Oct 28 2022 zhuofeng <zhuofeng2@huawei.com> - 3.12.0-1 * Fri Oct 28 2022 zhuofeng <zhuofeng2@huawei.com> - 3.12.0-1
- update to 3.12.0 - update to 3.12.0