Blob Blame History Raw
%global with_python3 1
%global pypi_name power
Name:           python-%{pypi_name}
Version:        1.4
Release:        5%{?dist}
Summary:        Cross-platform system power status information
License:        MIT
URL:            https://github.com/Kentzo/Power
Source0:        https://pypi.python.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python-setuptools

%if 0%{with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python-tools
%endif

%description
Python module that allows you to get power and battery status of the system.

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        Cross-platform system power status information

%description -n python3-%{pypi_name}
Python module that allows you to get power and battery status of the system.
%endif # with_python3

%prep
%setup -qn %{pypi_name}-%{version}

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!%{__python}|#!%{__python3}|'
%endif # with_python3

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
%endif # with_python3

%install
mkdir -p %{buildroot}%{python2_sitelib}
cp -ar build/lib/power %{buildroot}%{python2_sitelib}

%if 0%{?with_python3}
pushd %{py3dir}
mkdir -p %{buildroot}%{python3_sitelib}
cp -ar build/lib/power %{buildroot}%{python3_sitelib}
popd
%endif # with_python3

%check
%{__python2} -m unittest -v power.tests


%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} -m unittest -v power.tests
popd
%endif # with_python3

%files
%{python2_sitelib}/power
%files -n python3-%{pypi_name}
%{python3_sitelib}/power

%changelog
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Jan 25 2015 Miro Hrončok <mhroncok@redhat.com> - 1.4-1
- New version 1.4 (#1180510)
- No longer requires 2to3
- Run unittests

* Fri Sep 26 2014 Miro Hrončok <mhroncok@redhat.com> - 1.3-1
- New version 1.3 (#1128107)

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Thu May 22 2014 Miro Hrončok <mhroncok@redhat.com> - 1.2-2
- Rebuilt for Python 3.4

* Thu May 22 2014 Miro Hrončok <mhroncok@redhat.com> - 1.2-1
- Updated to 1.2

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-5.20121103git2cfe611
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Feb 20 2013 Miro Hrončok <mhroncok@redhat.com> - 1.1-4.20121103git2cfe611
- Introduced Python 3 subpackage

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-3.20121103git2cfe611
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Mon Jan 14 2013 Miro Hrončok <mhroncok@redhat.com> - 1.1-2.20121103git2cfe611
- Added python-setuptools BR

* Sun Jan 13 2013 Miro Hrončok <mhroncok@redhat.com> - 1.1-1.20121103git2cfe611
- First version