%global _empty_manifest_terminate_build 0
Name:           python-sphinxcontrib-autoprogram
Version:        0.1.9
Release:        2
Summary:        Documenting CLI programs
License:        BSD
URL:            https://github.com/sphinx-contrib/autoprogram
Source0:        https://files.pythonhosted.org/packages/c8/5f/044c87c306c9cbac68a4dccacb18ca0fdd4973096fdd92304ea069b11c59/sphinxcontrib-autoprogram-0.1.9.tar.gz
BuildArch:      noarch
%description
Documenting CLI programs

%package -n python3-sphinxcontrib-autoprogram
Summary:        Documenting CLI programs
Provides:       python-sphinxcontrib-autoprogram
# Base build requires
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-pbr
BuildRequires:  python3-pip
BuildRequires:  python3-wheel
# General requires
BuildRequires:  python3-sphinx
BuildRequires:  python3-six
BuildRequires:  python3-pytest
# General requires
Requires:       python3-sphinx
Requires:       python3-six
%description -n python3-sphinxcontrib-autoprogram
Documenting CLI programs

%package help
Summary:        Documenting CLI programs
Provides:       python3-sphinxcontrib-autoprogram-doc
%description help
Documenting CLI programs

%prep
%autosetup -n sphinxcontrib-autoprogram-%{version} -p1

%build
%py3_build


%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
    find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
    find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
    find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
    find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
    find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%check
# setup.py test removed in new setuptools; tests are unittest classes embedded in
# sphinxcontrib/autoprogram.py. System ships sphinxcontrib namespace packages whose
# .pth pre-registers the namespace, so pop it and load from source dir (needs ../doc).
%{__python3} -c "
import os, sys
sys.path.insert(0, os.getcwd())
sys.modules.pop('sphinxcontrib', None)
import pytest
sys.exit(pytest.main(['-q', 'sphinxcontrib/autoprogram.py']))
"

%files -n python3-sphinxcontrib-autoprogram -f filelist.lst
%dir %{python3_sitelib}/*


%files help -f doclist.lst
%{_docdir}/*

%changelog
* Thu Aug 20 2026 desert-sailor<dongxing.wang_a@thundersoft.com> - 0.1.9-2
- Replace removed setup.py test with in-source pytest run
  Work around sphinxcontrib namespace .pth by popping sys.modules
- Add missing BuildRequires python3-pytest used by %check

* Mon Jun 17 2024 Zengliwen <zengliwen@kylinos.cn> - 0.1.9-1
- Upgrade package to version 0.1.9

* Wed Jul 19 2023 Dongxing Wang <dxwangk@isoftstone.com> - 0.1.8-1
- update to 0.1.8

* Tue Jul 12 2022 huangtianhua <huangtianhua@huawei.com> - 0.1.7-2
- Fix argparse output for Python 3.10 compatibility

* Thu Aug 05 2021 OpenStack_SIG <openstack@openeuler.org> - 0.1.7-1
- Package Spec generate