sysutils/archey4: update to 4.14.0.0
This commit is contained in:
parent
e11449695a
commit
8254b3a476
5 changed files with 5 additions and 120 deletions
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= archey4
|
||||
PORTVERSION= 4.13.4
|
||||
PORTVERSION= 4.14.0.0
|
||||
CATEGORIES= sysutils python
|
||||
MASTER_SITES= PYPI
|
||||
|
||||
|
@ -13,7 +13,7 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
|
|||
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}distro>=1.3:sysutils/py-distro@${PY_FLAVOR} \
|
||||
${PYTHON_PKGNAMEPREFIX}netifaces>=0.10:net/py-netifaces@${PY_FLAVOR}
|
||||
|
||||
USES= python:3.6+
|
||||
USES= python:3.7+
|
||||
USE_PYTHON= autoplist distutils
|
||||
|
||||
do-test:
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1652740178
|
||||
SHA256 (archey4-4.13.4.tar.gz) = 9813ed0a1d5131756375e4113e6b158723d299353dab3d51b6ac0420af402e2c
|
||||
SIZE (archey4-4.13.4.tar.gz) = 95995
|
||||
TIMESTAMP = 1667652994
|
||||
SHA256 (archey4-4.14.0.0.tar.gz) = 4df716fcaee12017a99b6fefe5e474175a74dfbaa4a4ebe2a4f99afe2d5b2719
|
||||
SIZE (archey4-4.14.0.0.tar.gz) = 101196
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
--- archey/entries/cpu.py.orig 2022-05-17 20:52:34 UTC
|
||||
+++ archey/entries/cpu.py
|
||||
@@ -47,7 +47,7 @@ class CPU(Entry):
|
||||
else:
|
||||
# Darwin or any other BSD-based system.
|
||||
self.value = self._parse_system_profiler() or \
|
||||
- self._parse_sysctl_machdep()
|
||||
+ self._parse_sysctl_machdep() or self._parse_sysctl_cpu_model()
|
||||
|
||||
if not self.value:
|
||||
# This test case has been built for some ARM architectures (see #29).
|
||||
@@ -157,6 +157,24 @@ class CPU(Entry):
|
||||
[
|
||||
'sysctl', '-n',
|
||||
'machdep.cpu.brand_string', 'machdep.cpu.core_count'
|
||||
+ ],
|
||||
+ stderr=DEVNULL, universal_newlines=True
|
||||
+ )
|
||||
+ except (FileNotFoundError, CalledProcessError):
|
||||
+ return []
|
||||
+
|
||||
+ # `sysctl_output` should exactly contains two lines.
|
||||
+ model_name, nb_cores = sysctl_output.splitlines()
|
||||
+ return [{model_name: int(nb_cores)}]
|
||||
+
|
||||
+ @staticmethod
|
||||
+ def _parse_sysctl_cpu_model() -> List[Dict[str, int]]:
|
||||
+ # Runs `sysctl` to fetch some `hw.model and hw.ncpu` keys.
|
||||
+ try:
|
||||
+ sysctl_output = check_output(
|
||||
+ [
|
||||
+ 'sysctl', '-n',
|
||||
+ 'hw.model', 'hw.ncpu'
|
||||
],
|
||||
stderr=DEVNULL, universal_newlines=True
|
||||
)
|
|
@ -1,33 +0,0 @@
|
|||
--- archey/entries/model.py.orig 2022-05-17 21:03:36 UTC
|
||||
+++ archey/entries/model.py
|
||||
@@ -23,7 +23,8 @@ class Model(Entry):
|
||||
or self._fetch_dmi_info() \
|
||||
or self._fetch_sysctl_hw() \
|
||||
or self._fetch_raspberry_pi_revision() \
|
||||
- or self._fetch_android_device_model()
|
||||
+ or self._fetch_android_device_model() \
|
||||
+ or self._fetch_freebsd_model()
|
||||
|
||||
def _fetch_virtual_env_info(self) -> Optional[str]:
|
||||
"""
|
||||
@@ -179,3 +180,20 @@ class Model(Entry):
|
||||
return None
|
||||
|
||||
return f'{brand} ({model})'
|
||||
+
|
||||
+ @staticmethod
|
||||
+ def _fetch_freebsd_model() -> Optional[str]:
|
||||
+ """Retrieve `vendor` and `product` properties on FreeBSD """
|
||||
+ try:
|
||||
+ vendor = check_output(
|
||||
+ ['kenv', 'smbios.bios.vendor'],
|
||||
+ universal_newlines=True
|
||||
+ ).rstrip()
|
||||
+ product = check_output(
|
||||
+ ['kenv', 'smbios.system.product'],
|
||||
+ universal_newlines=True
|
||||
+ ).rstrip()
|
||||
+ except FileNotFoundError:
|
||||
+ return None
|
||||
+
|
||||
+ return f'{vendor} ({product})'
|
|
@ -1,46 +0,0 @@
|
|||
--- archey/entries/ram.py.orig 2022-02-08 18:10:31 UTC
|
||||
+++ archey/entries/ram.py
|
||||
@@ -1,5 +1,6 @@
|
||||
"""RAM usage detection class"""
|
||||
|
||||
+import os
|
||||
import platform
|
||||
import re
|
||||
|
||||
@@ -38,6 +39,9 @@ class RAM(Entry):
|
||||
if platform.system() == 'Linux':
|
||||
with suppress(IndexError, FileNotFoundError):
|
||||
return self._run_free_dash_m()
|
||||
+ elif platform.system() == 'FreeBSD':
|
||||
+ with suppress(FileNotFoundError):
|
||||
+ return self._run_sysctl_mem()
|
||||
else:
|
||||
# Darwin or any other BSD-based system.
|
||||
with suppress(FileNotFoundError):
|
||||
@@ -122,6 +126,26 @@ class RAM(Entry):
|
||||
) * page_size
|
||||
|
||||
return (used / 1024**2), (total / 1024**2)
|
||||
+
|
||||
+ @staticmethod
|
||||
+ def _run_sysctl_mem() -> Tuple[float, float]:
|
||||
+ """
|
||||
+ Return used and total memory on FreeBSD
|
||||
+ """
|
||||
+ output = check_output(
|
||||
+ ['sysctl', '-n', 'vm.stats.vm.v_page_count',
|
||||
+ 'vm.stats.vm.v_free_count',
|
||||
+ 'vm.stats.vm.v_inactive_count'],
|
||||
+ universal_newlines=True
|
||||
+ )
|
||||
+ total, free, inactive = [float(x) for x in output.splitlines()]
|
||||
+
|
||||
+ page_size = os.sysconf(os.sysconf_names['SC_PAGESIZE'])
|
||||
+
|
||||
+ mem_total = total * (page_size >> 10)
|
||||
+ mem_used = (total - free - inactive) * (page_size >> 10)
|
||||
+
|
||||
+ return (mem_used / 1024), (mem_total / 1024)
|
||||
|
||||
|
||||
def output(self, output):
|
Loading…
Reference in a new issue