packages: protobuf/protobuf.spec - add python bindings

glen glen at pld-linux.org
Sun Apr 29 23:06:03 CEST 2012


Author: glen                         Date: Sun Apr 29 21:06:03 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add python bindings

---- Files affected:
packages/protobuf:
   protobuf.spec (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: packages/protobuf/protobuf.spec
diff -u packages/protobuf/protobuf.spec:1.11 packages/protobuf/protobuf.spec:1.12
--- packages/protobuf/protobuf.spec:1.11	Sun Apr 29 22:58:15 2012
+++ packages/protobuf/protobuf.spec	Sun Apr 29 23:05:58 2012
@@ -1,12 +1,16 @@
 # $Revision$, $Date$
 # TODO:
-#	- add bindings for java and python
+#	- add bindings for java
+#
+# Conditional build:
+#
+%bcond_without	python	# Python bindings
 
 Summary:	Protocol Buffers - Google's data interchange format
 Summary(pl.UTF-8):	Protocol Buffers - format wymiany danych Google
 Name:		protobuf
 Version:	2.4.1
-Release:	1
+Release:	2
 License:	BSD
 Group:		Libraries
 Source0:	http://protobuf.googlecode.com/files/%{name}-%{version}.tar.bz2
@@ -14,11 +18,17 @@
 Source1:	ftdetect-proto.vim
 URL:		http://code.google.com/p/protobuf/
 BuildRequires:	autoconf
+BuildRequires:	rpmbuild(macros) >= 1.219
 BuildRequires:	automake
 BuildRequires:	libstdc++-devel
 BuildRequires:	libtool
 BuildRequires:	pkgconfig
 BuildRequires:	zlib-devel
+%if %{with python}
+BuildRequires:	python-devel
+BuildRequires:	python-distribute
+BuildRequires:	rpm-pythonprov
+%endif
 Requires:	%{name}-libs = %{version}-%{release}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -102,6 +112,16 @@
 %description static -l pl.UTF-8
 Statyczne biblioteki protobuf.
 
+%package -n python-protobuf
+Summary:	Python bindings for Google Protocol Buffers
+Group:		Development/Languages
+# does not use C++ library at this time
+Conflicts:	%{name} < %{version}
+Conflicts:	%{name} > %{version}
+
+%description -n python-protobuf
+This package contains Python libraries for Google Protocol Buffers
+
 %package -n vim-syntax-protobuf
 Summary:	Vim syntax highlighting for Google Protocol Buffers descriptions
 Group:		Development/Libraries
@@ -118,6 +138,13 @@
 %configure
 %{__make}
 
+%if %{with python}
+cd python
+%{__python} setup.py build
+%{__sed} -i -e 1d build/lib/google/protobuf/descriptor_pb2.py
+cd ..
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
@@ -132,6 +159,16 @@
 cp -p editors/proto.vim $RPM_BUILD_ROOT%{_vimdatadir}/syntax/proto.vim
 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_vimdatadir}/ftdetect/proto.vim
 
+%if %{with python}
+cd python
+%{__python} setup.py install \
+	--root=$RPM_BUILD_ROOT \
+	--single-version-externally-managed \
+	--optimize=2
+%py_postclean
+cd ..
+%endif
+
 cp -p examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
 
 %clean
@@ -182,6 +219,16 @@
 %{_libdir}/libprotobuf.a
 %{_libdir}/libprotoc.a
 
+%if %{with python}
+%files -n python-protobuf
+%defattr(644,root,root,755)
+%doc python/README.txt
+%dir %{py_sitescriptdir}/google
+%{py_sitescriptdir}/google/protobuf
+%{py_sitescriptdir}/protobuf-%{version}-py*.egg-info
+%{py_sitescriptdir}/protobuf-%{version}-py*-nspkg.pth
+%endif
+
 %files -n vim-syntax-protobuf
 %defattr(644,root,root,755)
 %{_datadir}/vim/ftdetect/proto.vim
@@ -193,6 +240,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.12  2012/04/29 21:05:58  glen
+- add python bindings
+
 Revision 1.11  2012/04/29 20:58:15  glen
 - package vim syntax
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/packages/protobuf/protobuf.spec?r1=1.11&r2=1.12



More information about the pld-cvs-commit mailing list