From 96c535b083484104f9ee4f2e05eb2502c494806d Mon Sep 17 00:00:00 2001 From: Raphael Groner Date: Nov 14 2019 17:07:14 +0000 Subject: verify dependencies --- diff --git a/python-pyvmomi.spec b/python-pyvmomi.spec index 5670307..5af4769 100644 --- a/python-pyvmomi.spec +++ b/python-pyvmomi.spec @@ -1,13 +1,14 @@ -%if 0%{?rhel} <= 6 -# FIXME maybe drop python2 but still for compatibility reasons -%global with_python2 1 -%endif +%{?python_disable_dependency_generator} + %if 0%{?rhel} >= 7 %global with_python3 1 +%global skip_tests 1 +%else +# generally disable python2, maybe as legacy for older rhel <= 6 +#%%global with_python2 1 %endif %if 0%{?fedora} %global with_python3 1 -%global with_python3_tests 1 %endif %global srcname pyvmomi @@ -18,7 +19,7 @@ ESX, ESXi, and vCenter. Name: python-%{srcname} Version: 6.7.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: vSphere Python SDK License: ASL 2.0 URL: https://github.com/vmware/%{srcname} @@ -28,44 +29,26 @@ BuildArch: noarch %description %desc -%if 0%{?with_python2} -%package -n python2-%{srcname} -Summary: vSphere Python SDK -BuildRequires: python2-devel -# FIXME add proper version suffixes of python subpackages -BuildRequires: python%{?!rhel:2}-testtools -BuildRequires: python%{?!rhel:2}-vcrpy -BuildRequires: python2-setuptools -BuildRequires: python2-requests -BuildRequires: python2-six -BuildRequires: python%{?!rhel:2}-fixtures -BuildRequires: python%{?!rhel:2}-tox -BuildRequires: python2-requests -BuildRequires: python2-six -%{?python_provide:%python_provide python2-%{srcname}} -Provides: python2-pyvim - -%description -n python2-%{srcname} -%desc -This package is for Python version 2. -%endif - %if %{with python3} %package -n python%{python3_pkgversion}-%{srcname} Summary: vSphere SDK for Python%{python3_other_version} BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-devel -%if 0%{?with_python3_tests} +BuildRequires: python%{python3_pkgversion}-requests +BuildRequires: python%{python3_pkgversion}-six + +Requires: python%{python3_pkgversion}-requests +Requires: python%{python3_pkgversion}-six + +# test dependencies +%if !0%{?skip_tests} BuildRequires: python%{python3_pkgversion}-testtools >= 0.9.34 BuildRequires: python%{python3_pkgversion}-vcrpy BuildRequires: python%{python3_pkgversion}-yarl BuildRequires: python%{python3_pkgversion}-fixtures BuildRequires: python%{python3_pkgversion}-tox %endif -BuildRequires: python%{python3_pkgversion}-requests -BuildRequires: python%{python3_pkgversion}-six -Requires: python%{python3_pkgversion}-requests -Requires: python%{python3_pkgversion}-six + %{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} Provides: python%{python3_pkgversion}-pyvim @@ -78,17 +61,21 @@ This package is for Python3 version %{python3_version} only. Summary: vSphere SDK for Python%{python3_other_version} BuildRequires: python%{python3_other_pkgversion}-setuptools BuildRequires: python%{python3_other_pkgversion}-devel -%if 0%{?with_python3_tests} +BuildRequires: python%{python3_other_pkgversion}-requests +BuildRequires: python%{python3_other_pkgversion}-six + +Requires: python%{python3_other_pkgversion}-requests +Requires: python%{python3_other_pkgversion}-six + +# test dependencies +%if !0%{?skip_tests} BuildRequires: python%{python3_other_pkgversion}-testtools >= 0.9.34 BuildRequires: python%{python3_other_pkgversion}-vcrpy BuildRequires: python%{python3_other_pkgversion}-yarl BuildRequires: python%{python3_other_pkgversion}-fixtures BuildRequires: python%{python3_other_pkgversion}-tox %endif -BuildRequires: python%{python3_other_pkgversion}-requests -BuildRequires: python%{python3_other_pkgversion}-six -Requires: python%{python3_other_pkgversion}-requests -Requires: python%{python3_other_pkgversion}-six + %{?python_provide:%python_provide python%{python3_other_pkgversion}-%{srcname}} Provides: python%{python3_other_pkgversion}-pyvim @@ -98,42 +85,67 @@ This package is for Python3 version %{python3_other_version} only. %endif %endif +##### begin legacy python2 +%if 0%{?with_python2} +%package -n python2-%{srcname} +Summary: vSphere Python SDK +BuildRequires: python2-devel +# FIXME add proper version suffixes of python subpackages +BuildRequires: python%{?!rhel:2}-testtools +BuildRequires: python%{?!rhel:2}-vcrpy +BuildRequires: python2-setuptools +BuildRequires: python2-requests +BuildRequires: python2-six +BuildRequires: python%{?!rhel:2}-fixtures +BuildRequires: python%{?!rhel:2}-tox +%{?python_provide:%python_provide python2-%{srcname}} +Provides: python2-pyvim + +%description -n python2-%{srcname} +%desc +This package is for Python version 2. +%endif +##### end legacy python2 + + %prep %autosetup -n %{srcname}-%{version} +# FIXME python validator does not like any explicit version +# upstream issue#735, rhbz#1763484 +# drop useless doublication of dependency generation +find -name \*requirements.txt -exec cp -v /dev/null '{}' \; + %build -%{?with_python2: %py2_build} %{?with_python3: %py3_build} %{?python3_other_pkgversion: %py3_other_build} +##### begin legacy python2 +%{?with_python2: %py2_build} +##### end legacy python2 + + %install -%{?with_python2: %py2_install} %{?with_python3: %py3_install} %{?python3_other_pkgversion: %py3_other_install} -%check -# FIXME python validator does not like any explicit version -# upstream issue#735 -sed -i -r 's:(.*)==.*:\1:g' test-requirements.txt +##### begin legacy python2 +%{?with_python2: %py2_install} +##### end legacy python2 -%{?with_python2: %{__python2} setup.py test} -%if 0%{?with_python3_tests} -%{__python3} setup.py test -# FIXME requests module is currently not available for python36 -%if 0 +find %{buildroot} -name requires.txt -print -delete + + +%check +%if !0%{?skip_tests} +%{?with_python3: %{__python3} setup.py test} %{?python3_other_pkgversion: %{__python3_other} setup.py test} %endif -%endif +##### begin legacy python2 +%{?with_python2: %{__python2} setup.py test} +##### end legacy python2 -%if 0%{?with_python2} -%files -n python2-%{srcname} -%license LICENSE.txt -%doc README.rst -%{python2_sitelib}/pyVmomi -%{python2_sitelib}/pyVim -%{python2_sitelib}/%{srcname}-%{version}-py?.?.egg-info -%endif %if 0%{?with_python3} %files -n python%{python3_pkgversion}-%{srcname} @@ -153,8 +165,24 @@ sed -i -r 's:(.*)==.*:\1:g' test-requirements.txt %{python3_other_sitelib}/%{srcname}-%{version}-py?.?.egg-info %endif +##### begin legacy python2 +%if 0%{?with_python2} +%files -n python2-%{srcname} +%license LICENSE.txt +%doc README.rst +%{python2_sitelib}/pyVmomi +%{python2_sitelib}/pyVim +%{python2_sitelib}/%{srcname}-%{version}-py?.?.egg-info +%endif +##### end legacy python2 + %changelog +* Thu Nov 14 2019 Raphael Groner - 6.7.3-3 +- rebuilt for vcpry>=2 etc., rhbz#1763484 +- avoid duplication of dependency generation +- [epel] try to enable tests for python3, still WIP + * Fri Sep 13 2019 Raphael Groner - 6.7.3-2 - [epel7] disable support for python2 due to failing tests