# Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 1} %define name python3-swiftclient %define srcname python-swiftclient %define version 3.8.1 %define release 1 %define is_python %(test -e /usr/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(python3_32 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif %define _libdir64 %{_prefix}/lib64 %define is_python_64 %(test -e /usr/bin/python3 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif Summary: Python Swift client API and command-line script. Name: %{name} Version: %{version} Release: %{release} Source0: http://pypi.python.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz URL: https://pypi.python.org/pypi/%{srcname} License: APL Group: Development/Libraries/Applications BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} Requires: python3 >= 3.7.4 Requires: python3-requests >= 1.1.0 Requires: python3-six >= 1.9.0 BuildArch: noarch %description Python-swiftclient includes a Swift API for Python (swiftclient) and a command line script (swift) to interface with an OpenStack Swift server. %prep %setup -q -n %{srcname}-%{version} %build python3 setup.py build if [ "%{dotests}" == 1 ] then python3 setup.py test || true fi %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} #renaming the files in bindir to avoid conflict with python-swiftclient cd ${RPM_BUILD_ROOT}/%{_bindir} for file in ${RPM_BUILD_ROOT}/%{_bindir}/*; do mv $file $file-3 done cd ${RPM_BUILD_ROOT} mkdir -p usr/bin cd usr/bin ln -sf ../..%{_bindir}/* . %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc AUTHORS PKG-INFO LICENSE README.rst CONTRIBUTING.rst ChangeLog requirements.txt %doc doc %{python_sitelib}/* /usr/bin/* %{_bindir}/* %changelog * Wed Jan 08 2020 Harshita Jain - 3.8.1-1 - Update with latest version - Build with python3 * Wed Aug 24 2016 Dylan McDougall - 3.0.0-1 - first version for AIX V6.1 and higher