]> git.pld-linux.org Git - packages/apt.git/commitdiff
- enhanced format patch, build python binding
authorJakub Bogusz <qboosh@pld-linux.org>
Sun, 8 Feb 2015 20:35:14 +0000 (21:35 +0100)
committerJakub Bogusz <qboosh@pld-linux.org>
Sun, 8 Feb 2015 20:35:14 +0000 (21:35 +0100)
apt-format.patch
apt.spec

index 3746193daaac2a2a515ca81a86ae06968839eeb2..64d01d90cb071998429df5e84dc520c41d27fe90 100644 (file)
         }
         if (KeyList.empty())
            KeyList = KeyID;
+--- apt-0.5.15lorg3.94a/python/apt_wrap.cxx.orig       2008-01-12 10:45:07.000000000 +0100
++++ apt-0.5.15lorg3.94a/python/apt_wrap.cxx    2015-02-08 21:21:33.543740596 +0100
+@@ -17503,7 +17503,7 @@
+     
+     if(!PyArg_ParseTuple(args,(char *)"Oss:GlobalError_Errno",&obj0,&arg2,&arg3)) goto fail;
+     if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_GlobalError,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+-    result = (bool)(arg1)->Errno((char const *)arg2,(char const *)arg3);
++    result = (bool)(arg1)->Errno((char const *)arg2,"%s",(char const *)arg3);
+     
+     resultobj = PyInt_FromLong((long)result);
+     return resultobj;
+@@ -17522,7 +17522,7 @@
+     
+     if(!PyArg_ParseTuple(args,(char *)"Oss:GlobalError_WarningE",&obj0,&arg2,&arg3)) goto fail;
+     if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_GlobalError,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+-    result = (bool)(arg1)->WarningE((char const *)arg2,(char const *)arg3);
++    result = (bool)(arg1)->WarningE((char const *)arg2,"%s",(char const *)arg3);
+     
+     resultobj = PyInt_FromLong((long)result);
+     return resultobj;
+@@ -17540,7 +17540,7 @@
+     
+     if(!PyArg_ParseTuple(args,(char *)"Os:GlobalError_Error",&obj0,&arg2)) goto fail;
+     if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_GlobalError,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+-    result = (bool)(arg1)->Error((char const *)arg2);
++    result = (bool)(arg1)->Error("%s",(char const *)arg2);
+     
+     resultobj = PyInt_FromLong((long)result);
+     return resultobj;
+@@ -17558,7 +17558,7 @@
+     
+     if(!PyArg_ParseTuple(args,(char *)"Os:GlobalError_Warning",&obj0,&arg2)) goto fail;
+     if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_GlobalError,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+-    result = (bool)(arg1)->Warning((char const *)arg2);
++    result = (bool)(arg1)->Warning("%s",(char const *)arg2);
+     
+     resultobj = PyInt_FromLong((long)result);
+     return resultobj;
index 65c8b24cee00451e6165e149635cae08c3ec9048..17f9148129adcb18d21d9a1f430487b7e9c96d08 100644 (file)
--- a/apt.spec
+++ b/apt.spec
@@ -1,6 +1,9 @@
 # TODO:
-# - build python bindings
 # - use system lua
+#
+# Conditional build:
+%bcond_without python  # Python binding
+#
 Summary:       Debian's Advanced Packaging Tool with RPM support
 Summary(pl.UTF-8):     Zaawansowane narzędzie do zarządzania pakietami
 Summary(pt.UTF-8):     Frontend avançado para pacotes rpm e deb
@@ -39,6 +42,11 @@ BuildRequires:       readline-devel
 BuildRequires: rpm-devel >= 5
 BuildRequires: sqlite3-devel
 BuildRequires: zlib-devel
+%if %{with python}
+BuildRequires: python-devel >= 2
+BuildRequires: rpm-pythonprov
+BuildRequires: swig-python
+%endif
 Requires:      gnupg
 Requires:      libxml2 >= 1:2.6
 Requires:      rpm
@@ -97,6 +105,18 @@ Static libapt-pkg library.
 %description static -l pl.UTF-8
 Statyczna biblioteka libapt-pkg.
 
+%package -n python-apt
+Summary:       Python bindings for libapt-pkg library
+Summary(pl.UTF-8):     Wiązania Pythona do biblioteki libapt-pkg
+Group:         Libraries/Python
+Requires:      %{name} = %{version}-%{release}
+
+%description -n python-apt
+Python bindings for libapt-pkg library.
+
+%description -n python-apt -l pl.UTF-8
+Wiązania Pythona do biblioteki libapt-pkg.
+
 %prep
 %setup -q -a5
 %patch0 -p1
@@ -107,6 +127,9 @@ Statyczna biblioteka libapt-pkg.
 %patch5 -p1
 %patch6 -p1
 
+# swig rebuild doesn't work (plain swig cannot cope with class Class::SubClass { })
+#%{__rm} python/{apt.py,apt_wrap.cxx}
+
 %build
 %{__gettextize}
 %{__libtoolize}
@@ -119,6 +142,12 @@ bash %configure
 
 %{__make}
 
+%if %{with python}
+%{__make} -C python \
+       CC="%{__cxx} %{rpmcxxflags} %{rpmcppflags}" \
+       PYTHON="%{__python}"
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT/var/cache/apt/archives/partial \
@@ -130,6 +159,15 @@ install -d $RPM_BUILD_ROOT/var/cache/apt/archives/partial \
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
+%if %{with python}
+install -d $RPM_BUILD_ROOT%{py_sitedir}
+install python/_apt.so $RPM_BUILD_ROOT%{py_sitedir}
+cp -p python/apt.py $RPM_BUILD_ROOT%{py_sitedir}
+%py_comp $RPM_BUILD_ROOT%{py_sitedir}
+%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
+%py_postclean
+%endif
+
 install doc/pl/*.8 $RPM_BUILD_ROOT%{_mandir}/pl/man8
 
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/apt/methods/bzip2
@@ -206,3 +244,10 @@ rm -rf $RPM_BUILD_ROOT
 %files static
 %defattr(644,root,root,755)
 %{_libdir}/libapt-pkg.a
+
+%if %{with python}
+%files -n python-apt
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py_sitedir}/_apt.so
+%{py_sitedir}/apt.py[co]
+%endif
This page took 0.074971 seconds and 4 git commands to generate.