1
0
python-py-cpuinfo/python-py-cpuinfo.spec

85 lines
2.7 KiB
RPMSpec

#
# spec file for package python-py-cpuinfo
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: python-py-cpuinfo
Version: 0.2.3
Release: 0
Summary: Get CPU info with pure Python 2 & 3
License: MIT
Group: Development/Languages/Python
Url: https://github.com/workhorsy/py-cpuinfo
Source: https://files.pythonhosted.org/packages/source/p/py-cpuinfo/py-cpuinfo-%{version}.tar.gz
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Requires(post): update-alternatives
Requires(preun): update-alternatives
%description
Py-cpuinfo gets CPU info with pure Python. Py-cpuinfo should work
without any extra programs or libraries, beyond what your OS
provides. It does not require any compilation(C/C++, assembly, et
cetera) to use. It works on Linux, OS X, Windows, BSD, Solaris,
Cygwin, Haiku, and BeagleBone. It currently only works on X86 and some
ARM CPUs.
These approaches are used for getting info:
1. Windows Registry (Windows)
2. /proc/cpuinfo (Linux)
3. sysctl (OS X)
4. dmesg (Unix/Linux)
5. isainfo and kstat (Solaris)
6. cpufreq-info (BeagleBone)
7. lscpu (Unix/Linux)
8. sysinfo (Haiku)
9. Querying the CPUID register (Intel X86 CPUs)
%prep
%setup -q -n py-cpuinfo-%{version}
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
mv %{buildroot}%{_bindir}/cpuinfo %{buildroot}%{_bindir}/cpuinfo-%{py_ver}
ln -s -f %{_sysconfdir}/alternatives/cpuinfo %{buildroot}%{_bindir}/cpuinfo
%post
%_sbindir/update-alternatives \
--install %{_bindir}/cpuinfo cpuinfo %{_bindir}/cpuinfo-%{py_ver} 30
%preun
if [ $1 -eq 0 ] ; then
%_sbindir/update-alternatives --remove cpuinfo %{_bindir}/cpuinfo-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc README.rst LICENSE ChangeLog
%{_bindir}/cpuinfo
%{_bindir}/cpuinfo-%{py_ver}
%ghost %{_sysconfdir}/alternatives/cpuinfo
%{python_sitelib}/*
%changelog