Blob Blame History Raw
%bcond_with tests

Name:           adb-enhanced
Version:        2.5.2
Release:        1%{?dist}
Summary:        Swiss-army knife for Android testing and development

License:        ASL 2.0
URL:            https://github.com/ashishb/adb-enhanced
Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools

%if %{with tests}
BuildRequires:  python3-pytest
%endif

%description
ADB-Enhanced is a Swiss-army knife for Android testing and development. A
command-line interface to trigger various scenarios like screen rotation,
battery saver mode, data saver mode, doze mode, permission grant/revocation.

%prep
%autosetup
# Move setup.py to the root directory
mv release/setup.py .
# Add version to setup.py and remove references
sed -i -e '5,6d' setup.py
sed -i -e '8,10d' setup.py
sed -i -e 's/version=version/version="%{version}"/g' setup.py
# Remove standard lib
sed -i -e '28d' setup.py

%build
%py3_build

%install
%py3_install

%if %{with tests}
%check
PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-%{python3_version} -v tests/adbe_tests.py
%endif

%files
%doc README.md
%license LICENSE
%{_bindir}/adbe
%{python3_sitelib}/adb_enhanced*.egg-info/

%changelog
* Wed Mar 18 2020 Fabian Affolter <mail@fabian-affolter.ch> - 2.5.2-1
- Initial package for Fedora