Fix build error due to attributeError

Signed-off-by: cherry530 <xuping33@huawei.com>
(cherry picked from commit fb859d30df01fb9b1f403efe967eedc9aa6c97d0)
This commit is contained in:
cherry530 2022-02-15 16:05:06 +08:00 committed by openeuler-sync-bot
parent cfa336d5db
commit 24a83ba01a
2 changed files with 54 additions and 1 deletions

View File

@ -6,7 +6,7 @@ ExcludeArch: i686
Name: 389-ds-base
Summary: Base 389 Directory Server
Version: 1.4.0.31
Release: 5
Release: 6
License: GPLv3+
URL: https://www.port389.org
Source0: https://releases.pagure.org/389-ds-base/389-ds-base-%{version}.tar.bz2
@ -17,6 +17,7 @@ Source3: https://github.com/jemalloc/jemalloc/releases/download/5.2.0/jema
Patch0: 0000-fix-compilation-failed.patch
Patch1: CVE-2021-3652.patch
Patch2: CVE-2021-3514.patch
Patch3: Fix-attributeError-type-object-build_manpages.patch
BuildRequires: nspr-devel nss-devel >= 3.34 perl-generators openldap-devel libdb-devel cyrus-sasl-devel icu
BuildRequires: libicu-devel pcre-devel cracklib-devel gcc-c++ net-snmp-devel lm_sensors-devel bzip2-devel
@ -362,6 +363,9 @@ exit 0
%{_mandir}/*/*
%changelog
* Tue Feb 15 2022 xu_ping<xuping33@huawei.com> - 1.4.0.31-6
- Fix attributeError
* Wed Sep 22 2021 liwu<liwu13@huawei.com> - 1.4.0.31-5
- fix CVE-2021-3652 CVE-2021-3514

View File

@ -0,0 +1,49 @@
From 7cee0c3184f948ff76a907cac007afc7a303169e Mon Sep 17 00:00:00 2001
From: Viktor Ashirov <vashirov@redhat.com>
Date: Tue, 18 Jan 2022 13:24:53 +0100
Subject: [PATCH] Issue 5115 - AttributeError: type object 'build_manpages'
has no attribute 'build_manpages'
Bug Description:
Starting from v2.1, argparse-manpage provides methods build_manpages,
get_build_py_cmd and get_install_cmd in the top-level module.
This breaks installation of lib389 on systems with the newer version
of argparse-manpage.
Fix Description:
Update setup.py to be aware of the module version and import methods
based on it.
Fixes: https://github.com/389ds/389-ds-base/issues/5115
Reviewed by: @tbordaz, @mreynolds389 (Thanks!)
---
src/lib389/setup.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/lib389/setup.py b/src/lib389/setup.py
index ce8b512..3f7947f 100644
--- a/src/lib389/setup.py
+++ b/src/lib389/setup.py
@@ -14,7 +14,9 @@
from setuptools import setup, find_packages
from os import path
-from build_manpages import build_manpages
+import build_manpages as bm
+if bm.__version__ < '2.1':
+ from build_manpages import build_manpages as bm
from setuptools.command.build_py import build_py
from setuptools.command.install import install
@@ -85,8 +87,8 @@ setup(
cmdclass={
# Dynamically build man pages for cli tools
- 'build_manpages': build_manpages.build_manpages,
- 'build_py': build_manpages.get_build_py_cmd(build_py),
+ 'build_manpages': bm.build_manpages,
+ 'build_py': bm.get_build_py_cmd(build_py),
}
)