From 41459c40924f0ccd3cdb938d2d7a9016ac8aa9ca Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Thu, 20 Apr 2017 14:15:04 +0200 Subject: [PATCH] - added s390x support - enable all supported archs --- py-cpuinfo-s390x.patch | 40 ++++++++++++++++++++++++++++++++++++++++ python-cpuinfo.spec | 11 +++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 py-cpuinfo-s390x.patch diff --git a/py-cpuinfo-s390x.patch b/py-cpuinfo-s390x.patch new file mode 100644 index 0000000..84e9837 --- /dev/null +++ b/py-cpuinfo-s390x.patch @@ -0,0 +1,40 @@ +diff -up py-cpuinfo-3.2.0/cpuinfo/cpuinfo.py.s390x py-cpuinfo-3.2.0/cpuinfo/cpuinfo.py +--- py-cpuinfo-3.2.0/cpuinfo/cpuinfo.py.s390x 2017-04-19 18:33:13.000000000 +0200 ++++ py-cpuinfo-3.2.0/cpuinfo/cpuinfo.py 2017-04-20 12:04:07.364919224 +0200 +@@ -1,4 +1,3 @@ +-#!/usr/bin/env python + # -*- coding: UTF-8 -*- + + # Copyright (c) 2014-2017, Matthew Brennan Jones +@@ -512,6 +511,10 @@ def parse_arch(raw_arch_string): + elif re.match('^powerpc$|^ppc64$|^ppc64le$', raw_arch_string): + arch = 'PPC_64' + bits = 64 ++ # S390X ++ elif re.match('^s390x$', raw_arch_string): ++ arch = 'S390X' ++ bits = 64 + # SPARC + elif re.match('^sparc32$|^sparc$', raw_arch_string): + arch = 'SPARC_32' +@@ -1791,8 +1794,8 @@ def get_cpu_info(): + # Make sure we are running on a supported system + def _check_arch(): + arch, bits = parse_arch(DataSource.raw_arch_string) +- if not arch in ['X86_32', 'X86_64', 'ARM_7', 'ARM_8', 'PPC_64']: +- raise Exception("py-cpuinfo currently only works on X86 and some PPC and ARM CPUs.") ++ if not arch in ['X86_32', 'X86_64', 'ARM_7', 'ARM_8', 'PPC_64', 'S390X']: ++ raise Exception("py-cpuinfo currently only works on X86 and some PPC and ARM CPUs and S390X.") + + def main(): + try: +diff -up py-cpuinfo-3.2.0/setup.py.s390x py-cpuinfo-3.2.0/setup.py +diff -up py-cpuinfo-3.2.0/tests/test_invalid_cpu.py.s390x py-cpuinfo-3.2.0/tests/test_invalid_cpu.py +--- py-cpuinfo-3.2.0/tests/test_invalid_cpu.py.s390x 2017-04-20 12:14:33.984425455 +0200 ++++ py-cpuinfo-3.2.0/tests/test_invalid_cpu.py 2017-04-20 12:52:36.746376882 +0200 +@@ -32,4 +32,4 @@ class TestInvalidCPU(unittest.TestCase): + cpuinfo._check_arch() + self.fail('Failed to raise Exception') + except Exception as err: +- self.assertEqual('py-cpuinfo currently only works on X86 and some PPC and ARM CPUs.', err.args[0]) ++ self.assertEqual('py-cpuinfo currently only works on X86 and some PPC and ARM CPUs and S390X.', err.args[0]) diff --git a/python-cpuinfo.spec b/python-cpuinfo.spec index 7ece9c4..31d5d37 100644 --- a/python-cpuinfo.spec +++ b/python-cpuinfo.spec @@ -3,17 +3,20 @@ Name: python-%{srcname} Version: 3.2.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: %{sum} License: MIT URL: https://github.com/workhorsy/py-cpuinfo Source0: https://files.pythonhosted.org/packages/source/p/py-%{srcname}/py-%{srcname}-%{version}.tar.gz +# s390x support +Patch0: py-cpuinfo-s390x.patch + BuildArch: noarch # https://github.com/workhorsy/py-cpuinfo/issues/55 -ExclusiveArch: %{ix86} x86_64 %{power64} noarch +# ExclusiveArch: %{ix86} x86_64 %{power64} s390x noarch BuildRequires: python2-devel BuildRequires: python-setuptools @@ -101,6 +104,10 @@ cp -p %{buildroot}/%{_bindir}/cpuinfo %{buildroot}/%{_bindir}/cpuinfo-3 %changelog +* Thu Apr 20 2017 Than Ngo - 3.2.0-2 +- added s390x support +- enable all supported archs + * Thu Apr 20 2017 Parag Nemade - 3.2.0-1 - Update to 3.2.0 version