From 93097992d68a0a42bfe1b0d6bc96a2ee17b32c04 Mon Sep 17 00:00:00 2001 From: Don Penney Date: Mon, 22 Oct 2018 16:48:38 -0400 Subject: [PATCH] Add hooks for python wheel generation This update adds hooks to the spec files for the following packages to generate wheels for the python modules: - ceph-manager - libvirt-python - logmgmt - platform-util - python-3parclient - python-cephclient - python-lefthandclient - python-ryu - vm-topology Change-Id: Ia63291e686818d19d0df52ff26b5f0bb3812b8ce Story: 2003907 Task: 26787 Signed-off-by: Don Penney --- virt/libvirt-python/centos/build_srpm.data | 2 +- .../0002-Build-python-wheel.patch | 72 +++++++++++++++++++ .../centos/meta_patches/PATCH_ORDER | 1 + ...tup-import-to-support-building-wheel.patch | 25 +++++++ 4 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 virt/libvirt-python/centos/meta_patches/0002-Build-python-wheel.patch create mode 100644 virt/libvirt-python/centos/patches/0001-Fix-setup-import-to-support-building-wheel.patch diff --git a/virt/libvirt-python/centos/build_srpm.data b/virt/libvirt-python/centos/build_srpm.data index 8aeb553..70b4b5d 100644 --- a/virt/libvirt-python/centos/build_srpm.data +++ b/virt/libvirt-python/centos/build_srpm.data @@ -1 +1 @@ -TIS_PATCH_VER=1 +TIS_PATCH_VER=2 diff --git a/virt/libvirt-python/centos/meta_patches/0002-Build-python-wheel.patch b/virt/libvirt-python/centos/meta_patches/0002-Build-python-wheel.patch new file mode 100644 index 0000000..49ca8c0 --- /dev/null +++ b/virt/libvirt-python/centos/meta_patches/0002-Build-python-wheel.patch @@ -0,0 +1,72 @@ +From 6f9c900059e3065081fccb19bd8c135036df5fe9 Mon Sep 17 00:00:00 2001 +From: Don Penney +Date: Wed, 17 Oct 2018 15:25:33 -0400 +Subject: [PATCH] Build python wheel + +--- + SPECS/libvirt-python.spec | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/SPECS/libvirt-python.spec b/SPECS/libvirt-python.spec +index 475bb0a..7a01e94 100644 +--- a/SPECS/libvirt-python.spec ++++ b/SPECS/libvirt-python.spec +@@ -36,6 +36,7 @@ Name: libvirt-python + Version: 4.7.0 + Release: 1%{?_tis_dist}.%{tis_patch_ver} + Source0: http://libvirt.org/sources/python/%{name}-%{version}.tar.gz ++Patch0: 0001-Fix-setup-import-to-support-building-wheel.patch + Url: http://libvirt.org + License: LGPLv2+ + BuildRequires: libvirt-devel == %{version} +@@ -44,6 +45,8 @@ BuildRequires: libvirt-devel == %{version} + BuildRequires: python2-devel + BuildRequires: python2-nose + BuildRequires: python2-lxml ++BuildRequires: python2-pip ++BuildRequires: python2-wheel + %else + BuildRequires: python-devel + BuildRequires: python-nose +@@ -106,6 +109,7 @@ of recent versions of Linux (and other OSes). + + %prep + %setup -q ++%patch0 -p1 + + # Unset execute bit for example scripts; it can introduce spurious + # RPM dependencies, like /usr/bin/python which can pull in python2 +@@ -120,6 +124,7 @@ exit 1 + + %if %{with_python2} + CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build ++%py2_build_wheel + %endif + %if %{with_python3} + CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build +@@ -128,6 +133,8 @@ CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build + %install + %if %{with_python2} + %{__python2} setup.py install --skip-build --root=%{buildroot} ++mkdir -p $RPM_BUILD_ROOT/wheels ++install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ + %endif + %if %{with_python3} + %{__python3} setup.py install --skip-build --root=%{buildroot} +@@ -166,4 +173,13 @@ CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build + %{python3_sitearch}/*egg-info + %endif + ++%package wheels ++Summary: %{name} wheels ++ ++%description wheels ++Contains python wheels for %{name} ++ ++%files wheels ++/wheels/* ++ + %changelog +-- +1.8.3.1 + diff --git a/virt/libvirt-python/centos/meta_patches/PATCH_ORDER b/virt/libvirt-python/centos/meta_patches/PATCH_ORDER index 91f9a80..90843c6 100644 --- a/virt/libvirt-python/centos/meta_patches/PATCH_ORDER +++ b/virt/libvirt-python/centos/meta_patches/PATCH_ORDER @@ -1 +1,2 @@ 0001-Update-package-versioning-for-TIS-format.patch +0002-Build-python-wheel.patch diff --git a/virt/libvirt-python/centos/patches/0001-Fix-setup-import-to-support-building-wheel.patch b/virt/libvirt-python/centos/patches/0001-Fix-setup-import-to-support-building-wheel.patch new file mode 100644 index 0000000..f931d0e --- /dev/null +++ b/virt/libvirt-python/centos/patches/0001-Fix-setup-import-to-support-building-wheel.patch @@ -0,0 +1,25 @@ +From 6c1041d2683f472dc645a44351b5938676e89738 Mon Sep 17 00:00:00 2001 +From: Don Penney +Date: Wed, 17 Oct 2018 15:26:37 -0400 +Subject: [PATCH] Fix setup import to support building wheel + +--- + setup.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 964a40e..263266d 100755 +--- a/setup.py ++++ b/setup.py +@@ -1,6 +1,7 @@ + #!/usr/bin/env python + +-from distutils.core import setup, Extension, Command ++from setuptools import setup ++from distutils.core import Extension, Command + from distutils.command.build import build + from distutils.command.clean import clean + from distutils.command.sdist import sdist +-- +1.8.3.1 +