Blame python-howdoi.spec

b80f25b
%global srcname howdoi
b80f25b
b80f25b
Name:           python-%{srcname}
b80f25b
Version:        2.0.16
b80f25b
Release:        2%{?dist}
b80f25b
Summary:        Instant coding answers via the command line
b80f25b
b80f25b
License:        MIT
b80f25b
URL:            https://github.com/gleitz/howdoi
b80f25b
# pypi archive does not contain test data
b80f25b
# Source0:        {pypi_source}
b80f25b
Source0:        %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz
b80f25b
b80f25b
BuildArch:      noarch
b80f25b
b80f25b
%global _description %{expand:
b80f25b
Sherlock, your neighborhood command-line sloth sleuth.
b80f25b
b80f25b
Are you a hack programmer? Do you find yourself constantly Googling for how to
b80f25b
do basic programming tasks?
b80f25b
b80f25b
Suppose you want to know how to format a date in bash. Why open your browser and
b80f25b
read through blogs (risking major distraction) when you can simply stay in the
b80f25b
console and ask howdoi:
b80f25b
b80f25b
    $ howdoi format date bash
b80f25b
    > DATE=`date +%%Y-%%m-%%d`}
b80f25b
b80f25b
%description %_description
b80f25b
b80f25b
%package -n python3-%{srcname}
b80f25b
Summary:        %{summary}
b80f25b
BuildRequires:  python3-devel
b80f25b
BuildRequires:  python3-pytest
b80f25b
BuildRequires:  python3-setuptools
b80f25b
BuildRequires:  python3dist(appdirs)
b80f25b
BuildRequires:  python3dist(cachelib)
b80f25b
BuildRequires:  python3dist(keep)
b80f25b
BuildRequires:  python3dist(pygments)
b80f25b
BuildRequires:  python3dist(pyquery)
b80f25b
b80f25b
%description -n python3-%{srcname} %_description
b80f25b
b80f25b
%prep
b80f25b
%autosetup -n %{srcname}-%{version} -p1
b80f25b
# remove shebang
b80f25b
sed -i.shebang '1d' howdoi/howdoi.py
e92ec2f
touch -r howdoi/howdoi.py.shebang howdoi/howdoi.py
b80f25b
b80f25b
%build
b80f25b
%py3_build
b80f25b
b80f25b
%install
b80f25b
%py3_install
b80f25b
b80f25b
%check
b80f25b
# some tests fail if run at once with
b80f25b
#   OSError: [Errno 24] Too many open files
b80f25b
# ``ulimit -n unlimited`` is not an option
b80f25b
TEST_CLASS=test_howdoi.py::HowdoiTestCase
b80f25b
skipped_tests=(multiple_answers position unicode_answer)
b80f25b
DESELECT=
b80f25b
for testcase in "${skipped_tests[@]}"; do
b80f25b
  DESELECT+=" --deselect ${TEST_CLASS}::test_${testcase}"
b80f25b
done
b80f25b
%pytest -v ${DESELECT}
b80f25b
for testcase in "${skipped_tests[@]}"; do
b80f25b
  SELECT+=" ${TEST_CLASS}::test_${testcase}"
b80f25b
done
b80f25b
%pytest -v ${SELECT}
b80f25b
b80f25b
%files -n python3-%{srcname}
b80f25b
%license LICENSE.txt
b80f25b
%doc CHANGES.txt README.rst
b80f25b
%{python3_sitelib}/%{srcname}-*.egg-info/
b80f25b
%{python3_sitelib}/%{srcname}/
b80f25b
%{_bindir}/%{srcname}
b80f25b
b80f25b
b80f25b
%changelog
b80f25b
* Wed Jun 30 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 2.0.16-2
b80f25b
- Escape %%s in description
b80f25b
- fix shebang in non-executable file
b80f25b
- Use `--deselect` to temporarily skip expensive tests
b80f25b
b80f25b
* Tue Jun 29 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 2.0.16-1
b80f25b
- Initial package