Blob Blame Raw
%bcond_without check
%global srcname OBD

Name:          python-%{srcname}
Version:       0.7.0
Release:       1%{?dist}
Summary:       OBD-II serial module for reading engine data
License:       GPLv2+
URL:           https://github.com/brendan-w/%{name}
Source0:       https://github.com/brendan-w/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
# Fix python dependency generator error
# error: Illegal char '*' (0x2a) in: 0.7.*
# error: Illegal char '*' (0x2a) in: 3.*
Patch0:        %{name}-dep-ver.patch
BuildArch:     noarch

%global desc A python module for handling realtime sensor data from OBD-II vehicle ports.\
Works with ELM327 OBD-II adapters, and is fit for the Raspberry Pi.

%description
%{desc}

%package -n python3-%{srcname}
Summary:       %{summary}
%{?python_provide:%python_provide python3-%{srcname}}
BuildRequires: python3-devel
%if %{with check}
BuildRequires: python3-pint >= 0.7
BuildRequires: python3-pytest
BuildRequires: python3-pyserial >= 3
%endif
%if 0%{fedora} < 30
Requires:      python3-pint >= 0.7
Requires:      python3-pyserial >= 3
%endif

%description -n python3-%{srcname}
%{desc}

Python 3 version.

%prep
%autosetup

%build
%py3_build

%install
%py3_install

%if %{with check}
%check
PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-3 -v
%endif

%files -n python3-%{srcname}
%license LICENSE
%{python3_sitelib}/obd-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/obd

%changelog
* Mon Mar 25 2019 Dominik Mierzejewski <rpm@greysector.net> - 0.7.0-1
- initial packaging
- fix dependency version declarations in setup.py