%global srcname pyVirtualize %global modname pyvirtualize %global date 20181003 %global commit0 57d2307f64f492b36fa99bc7c259210ec6a95635 %if 0%{?rhel} >= 7 || 0%{?fedora} %global with_python3 1 %endif %if 0%{?rhel} %global with_python2 1 %endif # FIXME epel7 Could not import extension sphinx.ext.githubpages (exception: No module named githubpages) %if 0%{?fedora} %global with_build_doc 1 %endif %global desc A python interface to access and manage VMware.\ \ pyVirtualize is build over pyVmomi, hence it has ability\ to perform all the operations what vSphere client is able to.\ \ pyVirtualize provides easy interfaces to:\ Connect to VMWare's ESX, ESXi, Virtual Center and\ Virtual Server hosts.\ Query hosts, datacenters, resource pools, virtual machines\ and perform various operations over them.\ VMs operations: power, file, process, snapshot, admin, utilities\ \ And of course, you can use it to access all the API through python. Name: python-%{modname} # pypi tells current version is 0.9 Version: 0.9 Release: 2.%{date}git%(c=%commit0; echo ${c:0:7} )%{?dist} Summary: Python module to access and manage VMware License: ASL 2.0 URL: https://github.com/rocky1109/%{srcname} Source0: %{url}/archive/%{commit0}.tar.gz#/%{srcname}-%{commit0}.tar.gz BuildArch: noarch %if 0%{?with_python2} BuildRequires: python2-devel BuildRequires: python2-setuptools %endif BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools %if 0%{?python3_other_pkgversion} BuildRequires: python%{python3_other_pkgversion}-devel BuildRequires: python%{python3_other_pkgversion}-setuptools %endif %if 0%{?rhel} BuildRequires: python2-sphinx # FIXME use python2 prefix when update is available in repo BuildRequires: python-sphinx_rtd_theme %endif %if 0%{?fedora} BuildRequires: python3-sphinx BuildRequires: python3-sphinx_rtd_theme %endif BuildRequires: web-assets-devel %description %desc %if 0%{?with_python2} %package -n python2-%{modname} Summary: %{summary} %{?python_provide:%python_provide python2-%{srcname}} Requires: python3-pyvmomi %description -n python2-%{modname} %desc %endif %if 0%{?with_python3} %package -n python%{python3_pkgversion}-%{modname} Summary: %{summary} %{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} Requires: python3-pyvmomi %description -n python%{python3_pkgversion}-%{modname} %desc %endif %if 0%{?python3_other_pkgversion} %package -n python%{python3_other_pkgversion}-%{modname} Summary: %{summary} %{?python_provide:%python_provide python%{python3_other_pkgversion}-%{srcname}} Requires: python3-pyvmomi %description -n python%{python3_other_pkgversion}-%{modname} %desc %endif %package doc Summary: Documentation files for %{srcname} Requires: js-jquery # some js files of documentation are licensed with BSD License: ASL 2.0 and BSD %description doc This package installs %{summary}. %prep %autosetup -n %{srcname}-%{commit0} %build %{?with_python2: %py2_build} %{?with_python3: %py3_build} %{?python3_other_pkgversion: %py3_other_build} %if 0%{?with_build_doc} # drop useless files rm -rfv docs/build/* sphinx-build -d docs/build/doctrees docs/source docs/build/html rm -fv docs/build/html/.buildtree %endif # unbundle jquery rm -v docs/build/html/_static/jquery*.js ln -fs %{_jsdir}/jquery/3/jquery.js docs/build/html/_static %install %{?python3_other_pkgversion: %py3_other_install} %{?with_python3: %py3_install} %{?with_python2: %py2_install} %if 0%{?with_python2} %files -n python2-%{modname} %license LICENSE %doc README.md %{python2_sitelib}/%{srcname}/ %{python2_sitelib}/%{srcname}-%{version}-py?.?.egg-info/ %endif %if 0%{?with_python3} %files -n python%{python3_pkgversion}-%{modname} %license LICENSE %doc README.md %{python3_sitelib}/%{srcname}/ %{python3_sitelib}/%{srcname}-%{version}-py?.?.egg-info/ %endif %if 0%{?python3_other_pkgversion} %files -n python%{python3_other_pkgversion}-%{modname} %license LICENSE %doc README.md %{python3_other_sitelib}/%{srcname}/ %{python3_other_sitelib}/%{srcname}-%{version}-py?.?.egg-info/ %endif %files doc %license LICENSE %doc docs/build/html/ %changelog * Thu Nov 01 2018 Raphael Groner - 0.9-2.20181003git57d2307 - use current snapshot - use python3 only in Fedora but still also python2 in EPEL - introduce modname macro * Tue Sep 04 2018 Raphael Groner - 0.9-1.20180205git4b01f44 - initial