From: biao716.wang Date: Thu, 1 Jun 2023 05:30:32 +0000 (+0900) Subject: fix build error for opensuse with python3.x X-Git-Tag: tizen/4.14.1.1.tizen20230628~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fsandbox%2Fwangbiao%2Fpy3-version;p=tools%2Flibrpm-tizen.git fix build error for opensuse with python3.x For opensuse154, the lib name is libpython3.6m , there is 'm' behind version. Change-Id: Ie51d20658d8799f3f1a0930a1a12527540999346 Signed-off-by: biao716.wang --- diff --git a/configure.ac b/configure.ac index a47b319f5..acdc5204c 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,7 @@ AC_MSG_CHECKING(old version of patch) AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH) AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH) -AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH) +AC_PATH_PROG(__PYTHON, python, /usr/bin/python3, $MYPATH) AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH) AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH) AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH) @@ -550,9 +550,10 @@ AS_IF([test "$enable_python" = yes],[ ]) CPPFLAGS="$save_CPPFLAGS" save_LIBS="$LIBS" - AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[ + + AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python3.6m],[ WITH_PYTHON_LIB="$ac_res" - ],[AC_MSG_ERROR([missing python library]) + ],[AC_MSG_ERROR([missing python library, ${PYTHON_VERSION} vvv${PYTHON_ABI}vvv]) ]) LIBS="$save_LIBS" ]) diff --git a/packaging/librpm-tizen.spec b/packaging/librpm-tizen.spec index 74045f450..e58b52e64 100644 --- a/packaging/librpm-tizen.spec +++ b/packaging/librpm-tizen.spec @@ -37,11 +37,7 @@ BuildRequires: pkgconfig(popt) BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(nss) BuildRequires: pkg-config -%if 0%{?centos_ver} || 0%{?centos_version} -BuildRequires: python-devel -%else -BuildRequires: pkgconfig(python) >= 2.6 -%endif +BuildRequires: pkgconfig(python3) # Disable security %if 0 BuildRequires: uthash-devel @@ -128,9 +124,9 @@ make install DESTDIR="`pwd`/tmp_install" # And only copy the files that we want install -d %{buildroot}%{_libdir}/%{name} -install -d %{buildroot}%{python_sitearch} +install -d %{buildroot}%{python3_sitearch} cp -ax tmp_install/%{_libdir}/%{name} %{buildroot}%{_libdir}/ -cp -ax tmp_install/%{python_sitearch}/%{python_mod_name} %{buildroot}%{python_sitearch}/ +cp -ax tmp_install/%{python3_sitearch}/%{python_mod_name} %{buildroot}%{python3_sitearch}/ # Install extra sources install -m644 %{SOURCE4} %{buildroot}%{_libdir}/%{name}/rpm/tizen_macros @@ -145,16 +141,16 @@ rm -rf "%{buildroot}%{_libdir}/%{name}/rpm-plugins" # Compile python modules (Fedora does this automatically) and find duplicates %if 0%{?suse_version} -%py_compile %{buildroot}/%{python_sitearch}/%{python_mod_name}/ -%py_compile -O %{buildroot}/%{python_sitearch}/%{python_mod_name}/ +%py3_compile %{buildroot}/%{python3_sitearch}/%{python_mod_name}/ +%py3_compile -O %{buildroot}/%{python3_sitearch}/%{python_mod_name}/ -%fdupes %{buildroot}/%{python_sitearch}/ +%fdupes %{buildroot}/%{python3_sitearch}/ %endif %files %defattr(-,root,root,-) %dir %{_libdir}/%{name} -%dir %{python_sitearch}/%{python_mod_name}/ +%dir %{python3_sitearch}/%{python_mod_name}/ %{_libdir}/%{name}/*.so.* %{_libdir}/%{name}/rpm -%{python_sitearch}/%{python_mod_name}/* +%{python3_sitearch}/%{python_mod_name}/*