b80f25b
%global srcname howdoi
b80f25b
b80f25b
Name:           python-%{srcname}
b62fdd8
Version:        2.0.20
ba48b2a
Release:        %autorelease
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
b62fdd8
BuildRequires:  python3-devel
b62fdd8
BuildRequires:  python3dist(pytest)
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
b62fdd8
23f2706
%package -n %{srcname}
b80f25b
Summary:        %{summary}
23f2706
Provides:       python3-%{srcname} = %{version}-%{release}
23f2706
Obsoletes:      python3-%{srcname} < 2.0.20-2
b80f25b
23f2706
%description -n %{srcname} %_description
b80f25b
b62fdd8
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
b62fdd8
%generate_buildrequires
b62fdd8
%pyproject_buildrequires
b62fdd8
b62fdd8
b80f25b
%build
b62fdd8
%pyproject_wheel
b62fdd8
b80f25b
b80f25b
%install
b62fdd8
%pyproject_install
b62fdd8
b62fdd8
%pyproject_save_files %srcname
b62fdd8
b80f25b
b80f25b
%check
b80f25b
TEST_CLASS=test_howdoi.py::HowdoiTestCase
b62fdd8
skipped_tests=(colorize)
b80f25b
DESELECT=
b80f25b
for testcase in "${skipped_tests[@]}"; do
b80f25b
  DESELECT+=" --deselect ${TEST_CLASS}::test_${testcase}"
b80f25b
done
b80f25b
%pytest -v ${DESELECT}
b80f25b
b62fdd8
23f2706
%files -n %{srcname} -f %{pyproject_files}
b80f25b
%license LICENSE.txt
b62fdd8
%doc CHANGES.txt README.md
b80f25b
%{_bindir}/%{srcname}
b80f25b
b80f25b
b80f25b
%changelog
ba48b2a
%autochangelog