Skip to content

Commit

Permalink
sysutils/py-py-cpuinfo: fix on armv7, add lscpu dependency
Browse files Browse the repository at this point in the history
On FreeBSD, armv[67] both report "arm" in "uname -m", but this package
expected the string armv6 or armv7.  Fix the port by adding an extra
case for just "arm" to the architecture detection logic.

While we are at it, optionally depend on sysutils/lscpu as an
additional data source for architecture features.

See also:	workhorsy/py-cpuinfo#197
Approved by:	yuri (maintainer)
Differential Revision: https://reviews.freebsd.org/D40252
  • Loading branch information
clausecker committed May 25, 2023
1 parent 41cce74 commit a1fbebb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sysutils/py-py-cpuinfo/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PORTNAME= py-cpuinfo
DISTVERSION= 8.0.0
PORTREVISION= 1
CATEGORIES= sysutils python
MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
Expand All @@ -16,4 +17,9 @@ USE_PYTHON= distutils concurrent autoplist

NO_ARCH= yes

OPTIONS_DEFINE= LSCPU
OPTIONS_DEFAULT= LSCPU
LSCPU_DESC= Use sysutils/lscpu as a data source
LSCPU_RUN_DEPENDS= lscpu:sysutils/lscpu

.include <bsd.port.mk>
11 changes: 11 additions & 0 deletions sysutils/py-py-cpuinfo/files/patch-cpuinfo_cpuinfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- cpuinfo/cpuinfo.py.orig 2023-05-24 07:26:57 UTC
+++ cpuinfo/cpuinfo.py
@@ -797,7 +797,7 @@ def _parse_arch(arch_string_raw):
elif re.match(r'^armv8-a|aarch64|arm64$', arch_string_raw):
arch = 'ARM_8'
bits = 64
- elif re.match(r'^armv7$|^armv7[a-z]$|^armv7-[a-z]$|^armv6[a-z]$', arch_string_raw):
+ elif re.match(r'^armv7$|^armv7[a-z]$|^armv7-[a-z]$|^armv6[a-z]$|^arm$', arch_string_raw):
arch = 'ARM_7'
bits = 32
elif re.match(r'^armv8$|^armv8[a-z]$|^armv8-[a-z]$', arch_string_raw):

0 comments on commit a1fbebb

Please sign in to comment.