summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorIan Wells <iawells@cisco.com>2019-08-09 17:27:19 -0700
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-08-12 23:39:40 +0000
commit13cef0cc2cba4cff22bb5a860a8709cb3cfd35b2 (patch)
tree8cabb009328b47ad2e3ec57d94d18078acb2d024 /extras
parent3705980a220dbc82c980f3baede1486c699f7503 (diff)
papi: Revert vpp-api-python to py2, add py3 pkg
A previous commit, ca3d38ae18c21ce37212f0d5d5f4a1702429e70c, converts the vpp-api-python package from a python2 library to a python3 one. This changes the behaviour of the package and breaks anything that uses it as a dependency. This change reverts the package behaviour to a python2 package, and additionally adds a *separate* python3 package for correct python3 behaviour. Type: fix Fixes: VPP-1738 Signed-Off-By: Ian Wells <iawells@cisco.com> Change-Id: I54eb45156eb6e00fc4cd5b48e7a0aa17fd2f43f7 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'extras')
-rw-r--r--extras/rpm/vpp.spec31
1 files changed, 29 insertions, 2 deletions
diff --git a/extras/rpm/vpp.spec b/extras/rpm/vpp.spec
index 8b8f10e774a..cb847f2f427 100644
--- a/extras/rpm/vpp.spec
+++ b/extras/rpm/vpp.spec
@@ -10,6 +10,17 @@
%endif
%define _vpp_install_dir install-%{_vpp_tag}-native
+# Failsafe backport of Python2-macros for RHEL <= 6
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+%{!?python_version: %global python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")}
+%{!?__python2: %global __python2 %{__python}}
+%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}}
+%{!?python2_sitearch: %global python2_sitearch %{python_sitearch}}
+%{!?python2_version: %global python2_version %{python_version}}
+
+%{!?python2_minor_version: %define python2_minor_version %(%{__python} -c "import sys ; print sys.version[2:3]")}
+
%{?systemd_requires}
@@ -39,12 +50,13 @@ BuildRequires: systemd, chrpath
BuildRequires: check, check-devel
BuildRequires: mbedtls-devel mbedtls
%if 0%{?fedora}
-Requires: vpp-lib = %{_version}-%{_release}, vpp-selinux-policy = %{_version}-%{_release}, net-tools, pciutils, python3
+Requires: vpp-lib = %{_version}-%{_release}, vpp-selinux-policy = %{_version}-%{_release}, net-tools, pciutils
Requires: compat-openssl10
Requires: boost-filesystem mbedtls libffi-devel
BuildRequires: subunit, subunit-devel
BuildRequires: compat-openssl10-devel
-BuildRequires: python3-devel, python3-virtualenv
+BuildRequires: python, python-devel, python-virtualenv, python-ply
+BuildRequires: python3, python36-devel, python3-virtualenv
BuildRequires: cmake
%else
%if 0%{rhel} == 7
@@ -128,6 +140,15 @@ Requires: python-setuptools
%description api-python
This package contains the python bindings for the vpp api
+%package api-python3
+Summary: VPP api python3 bindings
+Group: Development/Libraries
+Requires: vpp = %{_version}-%{_release}, vpp-lib = %{_version}-%{_release}, libffi-devel
+Requires: python-setuptools
+
+%description api-python3
+This package contains the python3 bindings for the vpp api
+
%package selinux-policy
Summary: VPP Security-Enhanced Linux (SELinux) policy
Group: System Environment/Base
@@ -154,6 +175,7 @@ groupadd -f -r vpp
make bootstrap AESNI=n
make -C build-root PLATFORM=vpp AESNI=n TAG=%{_vpp_tag} install-packages
%endif
+cd %{_mu_build_dir}/../src/vpp-api/python && %py2_build
cd %{_mu_build_dir}/../src/vpp-api/python && %py3_build
cd %{_mu_build_dir}/../extras/selinux && make -f %{_datadir}/selinux/devel/Makefile
@@ -210,6 +232,7 @@ do
done
# Python bindings
+cd %{_mu_build_dir}/../src/vpp-api/python && %py2_install
cd %{_mu_build_dir}/../src/vpp-api/python && %py3_install
# SELinux Policy
@@ -366,6 +389,10 @@ fi
%files api-python
%defattr(644,root,root,755)
+%{python2_sitelib}/vpp_*
+
+%files api-python3
+%defattr(644,root,root,755)
%{python3_sitelib}/vpp_*
%files selinux-policy