%{!?dotests: %define dotests 1} %define name python3-sphinxcontrib-htmlhelp %define srcname sphinxcontrib-htmlhelp %define version 1.0.2 %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: Sphinx extension for HTML help files Name: %{name} Version: %{version} Release: %{release} Source0: %{srcname}-%{version}.tar.gz Url: http://sphinx-doc.org/ License: BSD Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch BuildRequires: gettext >= 0.19.8.1-4 BuildRequires: python3 >= 3.7.4-1 BuildRequires: python3-devel >= 3.7.4-1 BuildRequires: python3-sphinx >= 2.3.0-1 BuildRequires: python3-pytest >= 5.3.1-1 #html5lib is required to run testcases Requires: python3 >= 3.7.4-1 %description sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files. %prep %setup -q -n %{srcname}-%{version} find -name '*.mo' -delete %build export OBJECT_MODE=64 for po in $(find -name '*.po'); do msgfmt --output-file=${po%.po}.mo ${po} done python3 setup.py build %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} # Move language files to /opt/freeware/share cd %{buildroot}%{python_sitelib} for lang in `find sphinxcontrib/htmlhelp/locales -maxdepth 1 -mindepth 1 -type d -not -path '*/\.*' -printf "%f "`; do test $lang == __pycache__ && continue install -d %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES mv sphinxcontrib/htmlhelp/locales/$lang/LC_MESSAGES/*.mo %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/ done rm -rf sphinxcontrib/htmlhelp/locales ln -s %{_datadir}/locale sphinxcontrib/htmlhelp/locales cd - %find_lang sphinxcontrib.htmlhelp %if %{dotests} %check python3 -m pytest || true %endif %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files -f sphinxcontrib.htmlhelp.lang %defattr(-,root,system,-) %doc README.rst LICENSE %{python_sitelib}/* %changelog * Mon Dec 30 2019 Reshma V Kumar -1.0.2-1 - Initial build for AIX Toolbox